日期:2014-05-17 浏览次数:20808 次
Ext.define('Tie',{
extend:'Ext.data.Model',
fields:[{name:'id',type:'int',mapping:'id'},
{name:'title',type:'string',mapping:'title'},
{name:'content',type:'string',mapping:'content'},
{name:'parentId',type:'int',mapping:'parentId'}
]
});
Ext.create('Ext.data.Store',{
storeId:'s_tie',
model:'Tie',
proxy:{
type:'ajax',
url:'/extjs/list.do',
reader:{
type:'json',
root:'topics'
},writer:{
type:'json'
}
},
autoLoad:true
});
<script type="text/javascript" src="ext/ext-all.js" ></script>
<script type="text/javascript" src="ext/model.js" ></script>
<script type="text/javascript" src="ext/ext-lang-zh_CN.js" ></script>
<script type="text/javascript" src="ext/bootstrap.js" ></script>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" />
<script type="text/javascript">
Ext.require(['Ext.grid.*','Ext.toolbar.Paging','Ext.data.*']);
Ext.onReady(function(){
Ext.QuickTips.init();
var gr=Ext.create('Ext.grid.Panel',{
title:'列表',
columns:[{header:"编号",dataIndex:'id'},
{header:"标题",dataIndex:'title'},
{header:"内容",dataIndex:'content'},
{header:"父编号",dataIndex:'parentId'}],
renderTo:'grid',
store:Ext.data.StoreManager.lookup('s_tie'),
height:200,
width:400
})
});
</script>
<title>Insert title here</title>
</head>
<body>
<div id="grid"></div>
</body>