extjs4学习之 store

下面是html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
    <!--ExtJs框架开始-->


<script type="text/javascript" src="ext.js"></script>
    <script type="text/javascript" src="ext-all.js"></script>
    <script src="locale/ext-lang-zh_CN.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" />


    <!--ExtJs框架结束-->
    <script type="text/javascript">
Ext.onReady(function () {
            var gridStore = Ext.create(‘Ext.data.Store‘, {  
fields: [  
{ name: ‘id‘, type: ‘string‘ },  
{ name: ‘name‘, type: ‘string‘ }  
],  
proxy: {  
type: ‘ajax‘,  
url: ‘./city.php‘,  
reader: {  
type: ‘json‘,  
root: ‘data‘  
}  
}  
});  
 
gridStore.load();


gridStore.load({ 
callback: function(records, options, success){  
gridStore.each(function (record) {  
alert(record.get(‘name‘));  
}); 

});
});
</script>
</head>
<body>
</body>

</html>


下面是city.php

{data:[{id:1,name:‘北京‘},{id:2,name:‘上海‘}]}

extjs4学习之 store,布布扣,bubuko.com

extjs4学习之 store

上一篇:Cstyle的札记,R&D必读手册,第4.1篇 Embedded Ethernet Controller (续)


下一篇:LAMP分离式之web服务器负载均衡架构之基于NFS共享式Discuz论坛