01.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
02.
03.<html xmlns="http://www.w3.org/1999/xhtml">
04.<head>
05. <title></title>
06. <!--ExtJs4.0官方下载css文件-->
07. <link href="extjs/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
08. <!--ExtJs4.0官方下载ExtJs文件-->
09. <script src="extjs/ext-all.js" type="text/javascript"></script>
10. <script language="javascript" type="text/javascript">
11. Ext.onReady(function () {
12. //我现在要将服务器那边返回来的json格式的数据通通读取到表格store中
13. var store = new Ext.data.Store({
14. fields: ["No", "Name", "Age", "Address"],
15. proxy: {
16. type: "ajax",
17. url: "users.json",
18. reader: {
19. type: "json",
20. root: "users"
21. }
22. }
23. });
24. store.load(function () {
25. //alert(store.data.length);
26. for (var i = 0; i < store.data.length; i++) {
27. alert(store.data.getAt(i).get("Name"));
28. }
29. });
30. });
31. </script>
32.</head>
33.<body>
34.
35.</body>
36.</html>
user.json文件
01.{
02. users:[
03. {No:'1001',Name:'张三',Age:'18.2333',Address:'深圳罗湖'},
04. {No:'1002',Name:'李四',Age:'22',Address:'深圳福田'},
05. {No:'1003',Name:'王五',Age:'21',Address:'深圳宝安'}
06. ],rows:'3'
07.}