Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/00a38869b5604f9e52ba390b3f468941 to your computer and use it in GitHub Desktop.
Save anonymous/00a38869b5604f9e52ba390b3f468941 to your computer and use it in GitHub Desktop.
Read the values of the GridWeb cells on Client Side - Java
<%@page language="java" contentType="text/html; charset=UTF-8" import="com.aspose.gridweb.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>">
<script type="text/javascript" language="javascript" src="grid/acw_client/acwmain.js"></script>
<script type="text/javascript" language="javascript" src="grid/acw_client/lang_en.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<title>Aspose.Cells.GridWeb for Java - Sample JSP Page</title>
<%
//Print GridWeb version on Console
System.out.println("Aspose.Cells.GridWeb for Java Version: " + GridWebBean.getVersion());
System.out.println(path);
System.out.println(basePath);
ExtPage BeanManager=ExtPage.getInstance();
GridWebBean gridweb=BeanManager.getBean(request);
out.println(gridweb.getHTMLHead());
%>
<script type="text/javascript">
function ReadGridWebCells() {
// Access GridWeb instance and cells array
var gridwebins = gridwebinstance.get("<%=gridweb.get_ClientID()%>");
var cells = gridwebins.getCellsArray();
// Log cell name, values, row & column indexes in console
for (var j = 0; j < cells.length; j++)
{
var cellInfo = j + ":" + gridwebins.getCellName(cells[j]) + ",";
cellInfo += "value is:" + gridwebins.getCellValueByCell(cells[j]) + " ,";
cellInfo += "row:" + gridwebins.getCellRow(cells[j]) + ",";
cellInfo += "col:" + gridwebins.getCellColumn(cells[j]);
console.log(cellInfo);
}
}
</script>
</head>
<body>
<%
gridweb.setReqRes(request, response);
gridweb.setEnableAJAX(true);
gridweb.setWidth(Unit.Pixel(400));
gridweb.setHeight(Unit.Pixel(400));
gridweb.prepareRender();
out.print(gridweb.getHTMLBody());
%>
<button type="button" onclick="ReadGridWebCells()">Click me</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment