Ext.ux.tree.treegrid异步加载数据
///前台 var grid = new Ext.ux.tree.TreeGrid({ title: '任务管理', width: 500, height: 300, enableDD: true, enableSort:false, rootVisible:false, columns:[{ header: '任务名称', dataIndex: 'Task_ID', width: 230 },{ header: '开始时间', width: 100, dataIndex: 'TaskName', align: 'center' }], root:new Ext.tree.AsyncTreeNode({ id:'0', loader:new Ext.tree.TreeLoader({ dataUrl: 'Data/Work_Task/Work_Task.aspx?flag=0', listeners:{ "beforeload":function(treeloader,node) { treeloader.baseParams={ treegrid_id:node.id, method:'POST' }; } } }) }), listeners: { "click":function(node,event) { if (node.isLeaf()) { event.stopEvent(); } else { event.stopEvent(); node.toggle(); } } } });
//后台返回值的方法 public string GetData_TaskInfo(string _id) { if (_id == "0") //第一次加载,只加载父节点 { string _fathers = ""; DataSet dsWorkInfo = TIS.Get_TaskInfo(_id, ""); foreach (DataRow r_Work in dsWorkInfo.Tables[0].Rows) { _fathers += "{leaf: false,id:'" + r_Work[0] + "',"; foreach (DataColumn column_Work in dsWorkInfo.Tables[0].Columns) { _fathers += column_Work.ColumnName + ":'" + r_Work[column_Work].ToString() + "',"; } _fathers = _fathers.Remove(_fathers.Length - 1, 1); _fathers += "},"; } if (_fathers == "") { return ""; } return _fathers = " [" + _fathers.Remove(_fathers.Length - 1, 1) + "]"; } else //第二次加载,加载子节点 { string _fathers = ""; DataSet dsStageTaskInfo = TIS.Get_StageTask(_id); foreach (DataRow r_StageTask in dsStageTaskInfo.Tables[0].Rows) { _fathers += "{leaf: true,"; foreach (DataColumn column_StageTask in dsStageTaskInfo.Tables[0].Columns) { _fathers += column_StageTask.ColumnName + ":'" + r_StageTask[column_StageTask].ToString() + "',"; } _fathers = _fathers.Remove(_fathers.Length - 1, 1); _fathers += "},"; } if (_fathers == "") { return ""; } return _fathers = " [" + _fathers.Remove(_fathers.Length - 1, 1) + "]"; } }
相关推荐
yangkang 2020-11-09
lbyd0 2020-11-17
sushuanglei 2020-11-12
85477104 2020-11-17
KANSYOUKYOU 2020-11-16
wushengyong 2020-10-28
lizhengjava 2020-11-13
星月情缘 2020-11-13
huangxiaoyun00 2020-11-13
luyong0 2020-11-08
腾讯soso团队 2020-11-06
Apsaravod 2020-11-05
PeterChangyb 2020-11-05
gaobudong 2020-11-04
wwwjun 2020-11-02
gyunwh 2020-11-02
EchoYY 2020-10-31
dingyahui 2020-10-30