var beforNode = null;//记录上一次选中的节点
var fundItemStore = Ext.create('Ext.data.TreeStore', {
model : 'BMS.Model.CheckableItem',
proxy: {
type :'ajax',
url : contextPath +'/bfoundation/service/item/mapping/relatedItem',
reader : {
type : 'json',
root : 'children'
}
},
listeners: {
beforeload: function (fundItemStore) {
fundItemStore.proxy.extraParams = {
domainId: Ext.getCmp('domain-combobox').getValue(),
budgetTypeCode:""
};
}
}
});
fundItemMapsGrid = Ext.create('Ext.tree.Panel', {
id : 'related-item-grid',
loadMask: true,
tbar: [itemField, {
width: 120,
xtype: "textfield",
id: "fund-item-mapping"
},'->',
{ xtype: 'button',
text: getLocalMessge("bms.msg.button.b001") ,
handler:function(){
searchItems('fund');
}
}],
width: 300,
split : true,
store:fundItemStore,
stripeRows: true,
rootVisible: false,
useArrows: true,
region: 'center',
style: 'border-bottom: none;',
viewConfig: {
forceFit: true
},
columns: [{
text: getLocalMessge("bms.msg.search.s040"),
dataIndex: 'code',
width:80
},{
xtype: 'treecolumn',
text: getLocalMessge("bms.msg.budget.configure.config210"),
dataIndex: 'name',
flex: 1
}]
});
fundItemMapsGrid.on('checkchange',function(node, checked) {
if(node.isNode){
if(beforNode != null){//把上一次选中节点取消选择
beforNode.set("checked",false);
}
beforNode = node;
node.collapse();
node.cascadeBy(function(node) {
node.set("checked",checked);
});
}
}, fundItemMapsGrid);
new Ext.LoadMask(fundItemMapsGrid, {
msg:'请稍等...',
store: fundItemStore
});