需要在树形表格加载时,将后台请求回来的数据直接返回给这个树形表格。
var treeGrideNodeId = that.modRelObjPL.modId;
var treeloader = new Ext.ux.tree.TreeGridLoader({
dataUrl: "treeGrid.do",
baseParams: {
nodeId: treeGrideNodeId, //传递id
name: search_mod_name1,// 传模糊搜索的名称
},
listeners: {
load: function (store, records, successful, eOpts) {
if (store.isRoot) {
for (var i = 1; i < records.childNodes.length; i++) {
records.childNodes[i].collapse();
} ;
isfirstTrue = false;
return;
}
}
}
});
var treeGrid = new Ext.ux.tree.TreeGrid({
width: 700,
id: "ext-comp",
bodyStyle: 'overflow-x:hidden; overflow-y:auto',
enableSort: false,// 默认为true,控件根据列的内容排序;置为false,则按照数据顺序显示
columns: [{
header: '模板名称',
dataIndex: 'nodeName',
width: 250,
align: 'center',
}, {
header: '模板id',
dataIndex: 'nodeId',
width: 60,
align: 'center',
style: "padding-left:10px",
}, {
header: '采集周期',
dataIndex: 'cycle',
align: 'center',
style: "padding-left:10px",
width: 60,
},
{
header: '上次发布结束日期',
dataIndex: 'endDate',
align: 'center',
width: 110,
style: "padding-left:10px",
}, {
header: '本次发布结束日期',
dataIndex: 'endDatePL',
align: 'center',
width: 110,
style: "padding-left:10px",
},
{
header: '选择发布',
dataIndex: 'checked',
align: 'center',
style: "padding-left:10px;z-index:9999",
width: 100,
id: "ext-comp-1071-xlhd-6"
}],
listeners: {
beforeload: function (node) {
//为了防止文件夹的重复打开
if (node.attributes.nodeId != undefined) {
treeGrid.loader.dataUrl = "treeGrid.do?nodeId=" + node.attributes.nodeId;
} else {
treeGrid.loader.dataUrl = "treeGrid.do?nodeId=" + that.modRelObjPL.modId;
}
},
render: function () {
},
} ,
loader: treeloader,
});
//添加到弹框中
Ext.getCmp("now_rel_boxPL").add(treeGrid)
Ext.getCmp("now_rel_boxPL").doLayout()
效果图