当我使用rowexpander插件展开行时,我试图在网格行中创建一个网格。如何在expandbody事件上渲染子网格?
到目前为止,这是我的代码,当我定义我的网格面板时,它被用作事件处理程序属性:
getOtherProducts: function (rowNode, record, expandRow, eOpts) {
$.ajax({
type: 'GET',
url: "Report.aspx/GetOtherProducts",
data: { ID: record.data['ID'] },
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function () {
var subStore = Ext.create('pr.store.Store-Products');
subStore.proxy.extraParams.productID = record.data['ID'];
var subGrid = Ext.create('Ext.grid.Panel', {
store: subStore
});
subGrid.getEl().swallowEvent(['mouseover', 'mousedown', 'click', 'dblclick']);
},
error: function () {
showNotificationBar("Error retrieving product data. Re-expand the row to try again.");
}
});
},发布于 2012-03-07 23:45:08
stratboogie在http://www.sencha.com/forum/showthread.php?151442-Nested-EXTJS-4-Grids的回答做到了这一点。
我稍微修改了一下,将元素ID存储到一个数组中
subGrids.push(subGrid.id);然后重写分页事件处理程序以遍历数组并销毁数组中具有ID的所有元素,以保持对内存的控制。
function destroySubGrids(){
Ext.each(subGrids, function(id){
var subGrid = Ext.getCmp(id);
if(subGrid){
subGrid.destroy();
delete subGrid;
}
});
subGrids = [];
console.log(Ext.ComponentMgr.all.length); //debug
}https://stackoverflow.com/questions/9588969
复制相似问题