HI,I rewrite the
Ext.ux.tree.PagingTreeLoader to support the ext3.0 rc1
this PagingTreeLoader has been tested in
IE6/firefox3/chrome1/safari4
PagingTreeLoader suports client paging and server paging:
1.client paging uages:
HTML Code:
var tree = new Ext.tree.TreePanel({
applyTo:'tree-ct',
width:300,
height:400,
autoScroll:true,
plugins: new Ext.ux.tree.TreeNodeMouseoverPlugin(),//must use the plugin
loader: new Ext.ux.tree.PagingTreeLoader({ //use the extend TreeLoader
dataUrl:'getNodes.jsp',
pageSize:10, //the count of the childnode to show every time,default 20
enableTextPaging:true, //whether to show the pagination's text
pagingModel:'local' //local means client paging ,remote means server paging,default local
}),
root: new Ext.tree.AsyncTreeNode({ id:'0',text:'root' })
});
the server just get the 'node' parameter value,and return the JSON like this:
HTML Code:
[{id:1,text:'node1',leaf:false,children:[{...},...{...}]},{id:1,text:'node2',leaf:true},...,{id:100,text:'node100',leaf:true}]
2.server paging uages:
the js code just change the pagingModel value to '
remote'.
the server will receive some parameters:
node : the id of the node which is expending or paging
start : the start index of the children,when the node first expends,the start value is 0
limit : equals the jscode's pageSize,means the count of the node to show ervery time
total : the total count of the node's children,when the node first expends,the total parameter dosen't exist.
the server return the JSON like this:
HTML Code:
{total:200,nodes:[{id:1,text:'node1',leaf:false},...,{id:100,text:'node100',leaf:false}]}