最近项目中用的EXT-JS,实在是很郁闷,第一次用都不知道怎么整, 请哪位知道的帮我解决一下,真的很着急。 代码如下:
var myData = [
['Tom','成都','xx@qq.com','15784215','1123434', '114512','修改'],
['Tom','成都','xx@qq.com','15784215','1123434', '114512','修改'],
['Tom','成都','xx@qq.com','15784215','1123434', '114512','修改'],
['Tom','成都','xx@qq.com','15784215','1123434', '114512','修改']
]
// example of custom renderer function
function change(val){
if(val > 0){
return '' + val + '';
}else if(val < 0){
return '' + val + '';
}
return val;
}
// example of custom renderer function
function pctChange(val){
if(val > 0){
return '<span style="color:green;">' + val + '%</span>';
}else if(val < 0){
return '<span style="color:red;">' + val + '%</span>';
}
return val;
}
var store = new Ext.data.Store({
proxy: new Ext.ux.data.PagingMemoryProxy(myData),
remoteSort:true,
sortInfo: {field:'price', direction:'ASC'},
reader: new Ext.data.ArrayReader({
fields: [
{name: 'name'},
{name: 'adress'},
{name: 'email'},
{name: 'call'},
{name: 'chuanzhen'},
{name: 'jianjie'},
{name: 'update'}
]
})
});
var sm2 = new xg.CheckboxSelectionModel({
listeners: {
selectionchange: function(sm) {
if (sm.getCount()) {
grid4.removeButton.enable();
} else {
grid4.removeButton.disable();
}
}
}
});
grid4 = new xg.GridPanel({
id:'button-grid',
store: store,
cm: new xg.ColumnModel([
sm2,
{id:'name',header: "姓名", width: 15,sortable: true, dataIndex: 'name'},
{header: "地址", width: 30, sortable: true, dataIndex: 'adress'},
{header: "电子邮件", width: 20, sortable: true,dataIndex: 'email'},
{header: "联系电话", width: 20, sortable: true, dataIndex: 'call'},
{header: "传真", width: 30, sortable: true, dataIndex: 'chuanzhen'},
{header: "简介", width: 20, sortable: true, dataIndex: 'jianjie'},
{header: "修改", width: 20, sortable: true, width: 20,dataIndex: 'update'}
]),
上面这个是JS的代码, 就是一张表格, 我现在想知道的就是现在我从数据库中获得的数据比如一个LIST的集合 怎么可以放进上面MyDAta这个数组里面去啊 , 上面这个数组是做页面的时候写死了的 ,现在怎么能把数据的数据放进这个数组里面去
哪位知道麻烦告诉小弟一下,要详细一点啊 谢谢 !