PDA

View Full Version : Tree.setChecked method is taking more time,



marudhai_S
14 Apr 2015, 9:39 PM
Hi,
I am using Gxt3.1 tree with checkbox. i am using tree.setChecked(model,CheckState.CHECKED); method to enable the checkbox.I'm having 18000 records ( treeStore.getAll().size() )in tree. Its taking near 6 mins to enable all the checkbox. Any suggestion would be greatefull.

<CODE>
List<BpuTreeModel> all= tree.getStore().getAll();
for (BpuTreeModel model : all) {
if(model.isCheck()){
tree.setChecked(model,CheckState.CHECKED);
}
}
</CODE>


Thanks in Advance.

Nicolas Gaborit
28 Jul 2015, 11:19 PM
Greetings,
I'd suggest to dig the idea of lazy initialization. I guess you don't need all your records to be displayed upfront. So maybe writing some code that enable checkboxes for the TreeNodes as they are being displayed would do the trick. I can think of binding a BeforeExpandItemHandler (http://docs.sencha.com/gxt/3.1/javadoc/com/sencha/gxt/widget/core/client/tree/Tree.html#addBeforeExpandHandler%28com.sencha.gxt.widget.core.client.event.BeforeExpandItemEvent.BeforeExpandItemHandler%29) that would enable the checkbox for all the children about to be displayed for the first time.