0

I have created a extjs tree with the json response i.e created from the php function. I am fetching the complete data at once and convert to json and then send the response to extjs . But fetching lakhs of records and getting response at once will be a long process and may the ajax timeout happens. 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). 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.

anupkumar
  • 357
  • 4
  • 14
  • 28

1 Answers1

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.

Here is a nice official example from Sencha.

FoxMulder900
  • 1,272
  • 13
  • 27
  • Thanks FoxMulder900.Could you have a example for this implementation.Please share so that its easy to understand..Thanks . – anupkumar Apr 11 '13 at 15:33
  • One thing that is confusing me is when I click on the parent node there is no ajax request send to server,then how is the response to be fetched from server automatically. – anupkumar Apr 11 '13 at 15:59
  • You may also need to make sure the parent node that you are trying to expand has "leaf":false configured so that ext knows that it needs to make a request for children. If that doesn't work for you I will try to put together a full example. – FoxMulder900 Apr 11 '13 at 16:30
  • Well i have created a tree ,but with all data loaded once and also its working.But Iam not getting how to load the data from server again and again(firing sql query on server end and get data from db according to parentid that extjs request has made).So please put a example here that would be really very helpfull for me.Thanks. – anupkumar Apr 11 '13 at 18:04
  • I don't know enough about sql to help you out there, but I edited my answer to include a link to an official example. – FoxMulder900 Apr 11 '13 at 18:35
  • Thanks for the example.I have also used the same code.but one issue that I foundin my code is for every click of parent node the node params is NaN.Can you please explain me of this Node params does. – anupkumar Apr 11 '13 at 19:19
  • Is that because I have loaded all the nodes at once? – anupkumar Apr 11 '13 at 19:24
  • Hmm, I'm not quite sure what you mean, maybe try posting some code? – FoxMulder900 Apr 11 '13 at 22:55