PDA

View Full Version : Are tree panels/grid buffered by default ?



jksuf
3 Mar 2015, 2:24 AM
Hi guys,

I have a server request that returns me a json string.
The json cannot be used directly into a treeStore, so I have to format it first and then put it in my store like this:


var store = Ext.create('Ext.data.TreeStore', {
root: parsedData
});

I use this store in a tree panel/grid setting its store property, defining 6~7 columns.

The json that I get from the server contains an array of parent objects (1200 items), and each parent contains around 5 items. The json file is around 8mo, but the problem is ot the json. The problem is that when I look in the html code (I'm using chrome debugger), every 1200 items of my store are rendered. Even if there are only 20 displayed.

I thougth that tree panel/grid were buffered by default, meaning that only the visible items are generated in the dom.

Am I missing something? Why do it get all items (1200) generated in the dom? (it makes the website very slow ^^")!

Thanks in advance !

PS: I can't call the result from the server in several parts/pages. I have to load all the 1200 items in one time.

yeghikyan
3 Mar 2015, 3:21 AM
yes, we often hope that the framework/programming language/library/api must be maximally adapted to our current technical requests and getting really upset, when it is not so ;)I see there several solutions:1. serverside array slice2. using chained store with loafing view store on the comming request3. using simple class which will make ajax request and keep the decoded json inside...

jksuf
3 Mar 2015, 5:22 AM
Hi yeghikyan, thanks a lot for your answer :) !!When I log my tree grid, the bufferedRenderer is set to false, but even if I set it to true in my controller, it will still render all the tree in the dom. I thank you for your workarounds, but I still would like to get this default behavior working, I don't know what I'm missing :/ !

jksuf
3 Mar 2015, 6:53 AM
So I have found the answer by debugging and trying to code very simple tree grid on my sencha fiddles.The issue is that I had my tree grid in the view port with " width: '100%', height: '100%' ". Settings the height to 100% is causing extjs not to create a bufferedRenderer (I don't know exactly why ^^"). So if I set my width and height hard coded (500 x 500 for instance), the bufferedRenderer is set and works fine :) !I will try using the fit layout to make my tree grid fill the height (cause I don't like to hard code dimensions) and will keep updating this post if it works well :) !

yeghikyan
3 Mar 2015, 7:44 AM
hmm, i have again forgotten about the limited size of my skull :D