首页 > Web开发 > 详细

extjs4学习之 store

时间:2014-03-27 03:40:41      阅读:449      评论:0      收藏:0      [点我收藏+]

下面是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

原文:http://blog.csdn.net/ws07_byyy/article/details/22219605

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!