PDA

View Full Version : Problem with the fireEvent in TreePanel...



Allan Stark
14 Dec 2012, 2:14 AM
ExtJS 4.1.1-gpl and 4.2.0-beta.

I'm trying to optimize size of loading tree's data by load only expanded nodes. Confuse by existing two events: itemClick (from view.Panel) and itemExpand (from Node interface).

First fired when user clicked only element, and second fired, when user clicked node icon (e.q. '+').
I am try to simple call itemClick event from itemExpand like


node.fireEvent('itemclick', this)

It's call (return 'true') but not worked (the code in itemClick does not work)...
Make one additional named function and put code in it and call it from both events is not a good idea, becouse this two events have so different args.

How to solve the problem?

mitchellsimoens
16 Dec 2012, 9:25 AM
I'm not too sure what you are trying to achieve.

Allan Stark
17 Dec 2012, 12:16 AM
Ok, I will explain.

This is sample:

40837

The click events of tree is divide into two events: itemclick (red) and itemexpand (green).
Now I work with big data with four nesting level. It seems to be right, if all nesting levels do load dynamically into treestore from for example php scenario.

So I put load code into itemclick event and try to fire this event from itemexpand by this:

node.fireEvent('itemclick', this)

It return true, but do not true call the itemclick event...

All the interesting test code:



...
'view_invoices_list': {
itemclick: function(view, record, item, index, e, obj) {
console.log('yes!');
},
itemexpand: function(node, obj) {
console.log(node.fireEvent('itemclick', this));
}
...

Allan Stark
17 Dec 2012, 1:22 AM
Ok. I'm solved my question by put all code in cellclick event, it fired in all clicks. Actually, I think it is intended if tree used like grid...