日期:2014-05-16 浏览次数:20351 次
<link href="../js/extjs/resources/css/ext-all.css" rel="stylesheet" type="text/css" /> <script src="../js/extjs/ext-all.js" type="text/javascript"> </script>
<script type="text/javascript" src="../js/afuer/lazyHibernate_js_base.js"> </script> <script type="text/javascript" src="../js/afuer/lazyHibernate_extjs_base.js"> </script>
Ext.define('User', { extend : 'Ext.data.Model', fields : [ { name : 'id', type : 'int' }, { name : 'username', type : 'string' }, { name : 'roles<0>_name', type : 'string' }, { name : 'organization_name', type : 'string' } ] });
var store1 = Ext.create('Ext.data.Store', { model : 'User', autoLoad : true, proxy : Ext.create('LazyHibernate.LazyAjax', { url : "listForExtjs" }) });
var grid = Ext.create('Ext.grid.Panel', { renderTo : Ext.getBody(), store : store1, width : 1000, height : 200, title : 'Show users with Lazy Hibernate in ExtJS', columns : [ { text : 'Name', width : 100, sortable : false, hideable : false, dataIndex : 'username' }, { text : 'ID ', flex : 1, dataIndex : 'id' }, { text : 'roleName, field base on roles<0>_name ', flex : 1, dataIndex : 'roles<0>_name' }, { text : 'roleName, field base on roles[0].name', flex : 1, dataIndex : 'roles[0].name' }, { text : 'Org Name, field base on organization_name', flex : 1, dataIndex : 'organization_name' } ] });