简体   繁体   English

Extjs 4.1树加载

[英]Extjs 4.1 tree loading

I have created a extjs tree with the json response ie created from the php function. 我用json响应创建了一个extjs树,即从php函数创建的。 I am fetching the complete data at once and convert to json and then send the response to extjs . 我要立即获取完整的数据并转换为json,然后将响应发送到extjs。 But fetching lakhs of records and getting response at once will be a long process and may the ajax timeout happens. 但是获取大量记录并立即获得响应将是一个漫长的过程,并且可能会发生ajax超时。 So what I am planning to do is to have the root nodes to be listed on first load of tree. 因此,我计划要做的是在树的第一个负载上列出根节点。 And then on click on parent node the child nodes will be loaded by sending the parent node id.(with the extjs proxy ajax). 然后单击父节点,将通过发送父节点ID(使用extjs代理ajax)加载子节点。 This will help server to have less load on it. 这将帮助服务器减轻负载。 I dont want to load the lakhs of data to be loaded once. 我不想加载要加载一次的数据。 The conclusion of this logic is to have the pagination on tree grid. 该逻辑的结论是在树状网格上进行分页。 So my question is that is this feature supported on current version of extjs 4.1 tree. 所以我的问题是,当前版本的extjs 4.1树是否支持此功能。

Yes, Simply do NOT send the "children" attribute of any node you do not wish to be loaded right away. 是的,请不要直接发送您不希望立即加载的任何节点的“子级”属性。 ExtJS will automatically make another request when you try to expand a non-leaf node without any children. 当您尝试扩展没有任何子节点的非叶子节点时,ExtJS将自动发出另一个请求。

Here is a nice official example from Sencha . 这是Sencha的一个很好的官方示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM