extjs4 零碎笔记

来源:互联网 发布:ubuntu 16.04 精简 编辑:程序博客网 时间:2024/05/06 01:37
var grid = Ext.getCmp('Grid的id'); 
var record = grid.getSelectionmodel().getSelected();//如果sm是RowSelectionModel 
(var records = grid.getSelectionModel().getSelections;//如果是CheckboxSelectModel 
var record = records[0]) 
//以上需要判断getCount()是不是大于0 

这样就可以得到选中行的数据了record.data就是选中行的数据


panel去边框 border:false,frame:0


grid查询数据,必须使用beforeload事件,否则参数会传不进去。如:

productsStore.on('beforeload', function(store, options) {
var new_params = {
qtype : Ext.getCmp('qtype').getValue(),
keyword : Ext.getCmp('keyword').getValue(),
isSearch : isSearch
};
Ext.apply(store.proxy.extraParams, new_params);
isSearch = null;
// alert('beforeload');
});


grid行点击事件使用itemclick。在grid中使用listener配置项。

listeners : {
itemclick : click
}

// 列表行点击事件响应函数
function click(self, record) {

productsID = record.data['productsID'];
Ext.Msg.alert('', productsID);
setActive('detailInquiry');
loadDetail(productsID);
priceStore.loadPage(1);
}