Extjs异步加载树
2014-02-11 17:35
316 查看
store代码:
var storeTree_<?=$jsObjectSuffix?> = Ext.create('Ext.data.TreeStore', {
nodeParam: 'PID',
fields: [
{name: 'text', type: 'string'},
{name: 'iconCls', type: 'string'},
{name: 'className', type: 'string'}
],
proxy: {
type: 'ajax',
url: 'url'
},
root: {
text: '根节点',
id: 0,
expanded: true
},
reader:{
type: 'json'
},
autoLoad: true
});
Ext.tree.panel代码:
{
xtype: "button",
text: "查看权限树",
handler: function(){
Ext.create('Ext.window.Window', {
title: '权限树',
closeAction: 'hide',
width: 450,
height: 300,
layout: 'fit',
modal:true,
items:[
{
xtype: 'treepanel',
rootVisible: false,
width: 200,
height: 150,
store: storeTree_<?=$jsObjectSuffix?>,
listeners:{
'load': function(treestore, node, record, success){
if(success && record.length>0){
node.set('leaf', false);
}else{
node.set('leaf', true);
}
}
}
}
var storeTree_<?=$jsObjectSuffix?> = Ext.create('Ext.data.TreeStore', {
nodeParam: 'PID',
fields: [
{name: 'text', type: 'string'},
{name: 'iconCls', type: 'string'},
{name: 'className', type: 'string'}
],
proxy: {
type: 'ajax',
url: 'url'
},
root: {
text: '根节点',
id: 0,
expanded: true
},
reader:{
type: 'json'
},
autoLoad: true
});
Ext.tree.panel代码:
{
xtype: "button",
text: "查看权限树",
handler: function(){
Ext.create('Ext.window.Window', {
title: '权限树',
closeAction: 'hide',
width: 450,
height: 300,
layout: 'fit',
modal:true,
items:[
{
xtype: 'treepanel',
rootVisible: false,
width: 200,
height: 150,
store: storeTree_<?=$jsObjectSuffix?>,
listeners:{
'load': function(treestore, node, record, success){
if(success && record.length>0){
node.set('leaf', false);
}else{
node.set('leaf', true);
}
}
}
}
相关文章推荐
- Extjs中加载异步树的最简单例子实现
- ExtJS 异步加载树
- Extjs RowExpander的扩展,支持异步加载
- ExtJS——TreeGrid异步加载
- ExtJS入门教程05,grid的异步加载数据
- 实用ExtJS教程100例-010:ExtJS Form异步加载和提交数据
- 『ExtJS』树 异步加载数据
- Extjs学习总结之26treepanel异步加载
- 『ExtJS』树 异步加载数据
- 动态异步加载树 ExtJS2,以JSON(JavaScript Object Notation)TreeLoader
- Extjs4---treepanel+struts2异步加载,用的accordion布局,MVC做的
- extjs异步加载树的子节点
- Extjs combox的异步加载
- 【ExtJS实践】之一 :TreeGrid异步加载数据
- Extjs 动态异步加载树
- extjs 3.x简单的异步树 并实现展开时重新加载数据的实现
- 自写的jQuery异步加载数据添加事件
- [extjs3.4]延迟、动态加载js文件
- 异步加载网络图片代码块
- Asp.net 利用Div固定表头+异步显示动态加载