<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="<%=request.getContextPath() +
"/dojo1.4.3/dijit/themes/tundra/tundra.css"%>" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dojox/grid/resources/Grid.css"%>" />
<link rel="stylesheet" href="<%=request.getContextPath() + "/dojo1.4.3/dojox/grid/resources/tundraGrid.css"%>" />
<title>Insert title here</title>
</head>
<body class="tundra landing" >
<div id="billsGrid" style="height:400px; width:200px;" dojoType="dojox.grid.DataGrid" escapeHTMLInData="false" >
</div>
</body>
<script language="JavaScript" src="<%=request.getContextPath() +
"/dojo1.4.3/dojo/dojo.js"%>" djconfig="parseOnLoad:true"></script>
<script type="text/javascript">
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.parser.parse();
itemData={"layout":[{"field":"docId","name":"DocId","width":"auto"},
{"field":"docName","name":"DocName","width":"auto"}],
"identifier":"docId",
"items":[{"docId":"244","docName":"balanceSheet"},
{"docId":"255","docName":"incomeSheet"}]}
// i will be getting the response as data to be populated in grid
var dataStore = new dojo.data.ItemFileReadStore(
{ data:itemData }
);
var grid = dijit.byId("billsGrid"); // data grid id
grid.setStructure(itemData.layout); // setting physical structure
grid.setStore(dataStore); // setting the data
</script>
</html>
No comments:
Post a Comment