PDA

View Full Version : Ext tree grid event conflict



Xjw919
13 Feb 2014, 1:17 AM
Ext tree grid event conflict
Here, I made a treegrid refered to this example,http://docs.sencha.com/extjs/4.2.0/extjs-build/examples/build/KitchenSink/ext-theme-neptune/#tree-grid .
The difference is that I add a itemclick listener to the tree leftside in my app,and a handler to the last column (which xtype is actioncolumn as the example showed) .
Here comes the question. When I click the icon in the last actioncolumn ,it not only fire the column action event but also the tree itemclick event. So how to solve this problem? I try to use "event.stopEvent()" and "event.stopPropagation()" functions ,but failed. So help me, thanks.
47913

LesJ
13 Feb 2014, 7:00 AM
Return false from the event handler.

Xjw919
13 Feb 2014, 4:41 PM
Return false from the event handler.

well just like the stopEvent() and stopPropagation() functions in the handler ,return false doesn't make any sense.:(

Xjw919
13 Feb 2014, 5:39 PM
well today I add a if statement to the itemclick event ,and the question resolved.Here is the core code:

treeObj.addListener('itemclick', function(node, record, item, index, event, eOpts){ //get the grid cellIndex you clicked var colIdx = event.getTarget('.x-grid-cell').cellIndex; //compare the cellIndex with the cellIndex of your tree exist if(colIdx == 0){ //your core code }}