日期:2014-05-16 浏览次数:21062 次
public List findAll() { //这是后台数据 return bookDAO.findAll(); }
Ext.onReady(function(){ getBook.findAll(callBackResult); function callBackResult(_data){ function formatDate(value){ return value ? value.dateFormat('M d,Y') :''; }; var fm = Ext.form, Ed = Ext.grid.GridEditor; var ds = new Ext.data.Store({ proxy: new Ext.data.MemoryProxy(eval(_data)), reader: new Ext.data.JsonReader({root:'Book'},[ {name: 'bookId'}, {name: 'bookName'}, {name: 'pubType'}, {name: 'price'} ]) }); var cm = new Ext.grid.ColumnModel([ {id: 'bookId', header: "BOOKID", dataIndex: 'bookId', width: 200, align: 'center'}, {header: "BOOKNAME", dataIndex: 'bookName', width: 100, align: 'center', editor: new Ed(new fm.TextField({allowBlank: false}))}, {header: "PUBDATE", dataIndex: 'pubDate', width: 100, align: 'center', editor: new Ed(new fm.DateField({format:'m/d/y', minValue:'01/01/06',disabledDays: [0, 6],disabledDaysText: 'Plants are not available on the weekends'}))}, {header: "PRICE", dataIndex: 'price', width: 100, align: 'center', editor: new Ed(new fm.TextField({allowBlank: false}))} ]); cm.defaultSortable = true; var sm=new Ext.grid.RowSelectionModel(); var grid = new Ext.grid.Grid('editor-grid', { ds: ds, cm: cm, selModel: sm, autoSizeColumns: true, monitorWindowResize: false, trackMouseOver: true }); grid.render(); ds.load(); } });