//***********************************************左边树开始***********************************************
//分组树Store
var treeStore = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: "/Handler/StorePositionLayoutHandler.ashx?func=getbystorestorepositionlist&format=list"
},
autoLoad: false,
fields: ['text', 'id', 'leaf', 'SPLId', 'SPLName', 'StoreId', 'Level1', 'Level2', 'Level3', 'levelType'],
reader: {
type: "json",
root: ''
},
extraParams: {
SPLId: '',
StoreId: '',
Level1: '',
Level2: '',
Level3: '',
levelType: '',
}
});
//分组树
var treePanel = Ext.create('Ext.tree.Panel', {
store: treeStore,
border: false, //边框
enableDD: true,
rootVisible: false, //隐藏根节点
useArrows: true, //树节点使用箭头
containerScroll: true,
collapsible: false,
autoScroll: false,
title: '货位信息列表',
columns: [{
xtype: 'treecolumn',
text: '货位层次',
dataIndex: 'text',
width: 150,
sortable: true
}, {
text: '货位名称',
dataIndex: 'SPLName',
flex: 1,
sortable: true
}],
//点击目录树+前 给root参数赋值
listeners: {
//树列表单击,取值赋值给id:xxxx的文本框
itemclick: function (node, record, item, index, event, eOpts) {
//给右侧页面赋值 开始
var id = record.data.id;
var text = record.data.text;
var SPLId = record.data.SPLId;
var SPLName = record.data.SPLName;
var StoreId = record.data.StoreId; BelowForm.setTitle('当前货位:' + text + '' + SPLName); BelowForm.form.findField('SPLId').setValue(SPLId);
BelowForm.form.findField('SPLName').setValue(SPLName);
//给右侧页面赋值 结束
},
//点击目录树+前 给root参数赋值
beforeitemexpand: function (record, eOpts) {
if (treePanel != undefined) {
var root = treePanel.store.getProxy();
root.extraParams.SPLId = record.data.SPLId;
root.extraParams.StoreId = record.data.StoreId;
root.extraParams.Level1 = record.data.Level1;
root.extraParams.Level2 = record.data.Level2;
root.extraParams.Level3 = record.data.Level3;
root.extraParams.levelType = record.data.levelType;
}
}
}
//singleExpand:true //展示单个子节点,其它的子节点合并。
});
//treePanel.expandAll(); //展开所有节点
treePanel.collapseAll(); //关闭所有节点 //***********************************************左边树结束***********************************************