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,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。