grid.getSelectionModel().selectFirstRow(); // 默认选择第一行
var store = new Ext.data.SimpleStore( {
fields: [
{ name: ' company ' } ,
{ name: ' price ' , type: ' float ' } ,
{ name: ' change ' , type: ' float ' } ,
{ name: ' pctChange ' , type: ' float ' } ,
{ name: ' lastChange ' , type: ' date ' , dateFormat: ' n/j h:ia ' }
]
} );
store.loadData(myData); // 加载数据
var fnAjaxDemo = function() {
var mydata;
Ext.Ajax.request({
url: "MyService.svc/GetClsData?name=" + encodeURIComponent(Ext.get("ProductName").dom.value), //服务器端地址
success: function(request) {
store.loadData(eval(request.responseText));
},
failure: function() {
alert("failure!");
}
});
}
Ext.get("btnRefresh").on("click", fnAjaxDemo);
3. 如果设置了autoExpandColumn,则autoExpandColumn对应的列,必须是id对应的列,否则出错