PDA

View Full Version : selectionchange treepanel get parent view



maneljn
30 Jul 2012, 11:37 PM
How can i get the parent view (treepanel) from inside selectionchange event ??

Farish
31 Jul 2012, 12:18 AM
try this and see if it works:


var tree = this.up('tree');

if it doesnt work, also try 'treepanel' with up

maneljn
31 Jul 2012, 12:42 AM
Farish inside selection change i only have these parameters to accomplish the objective

selectionchange (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.panel.Table-event-selectionchange)( Ext.selection.Model (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.selection.Model) this, Ext.data.Model (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.data.Model)[] selected, Object (http://docs.sencha.com/ext-js/4-1/#%21/api/Object) eOpts )Fired after a selection change has occurred
Parameters

this : Ext.selection.Model (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.selection.Model)
selected : Ext.data.Model (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.data.Model)[]The selected records

eOpts : Object (http://docs.sencha.com/ext-js/4-1/#%21/api/Object)The options object passed to Ext.util.Observable.addListener (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.util.Observable-method-addListener).

Farish
31 Jul 2012, 12:47 AM
yes. I am expecting it to work. this is the selection model of your tree panel. if you go "up" looking for tree or treepanel, you should be able to find your tree panel. give it a try. you have to use it inside the listener for selectionchange event.

maneljn
31 Jul 2012, 1:23 AM
onSelectionchange: function( sm, selections, eOpts) {
var me = this;
console.log (sm.up());
.....











i got this error



TypeError: sm.up is not a function



chrome://firebug/content/blank.gif


this.selectWithEvent(record, e);

Farish
31 Jul 2012, 2:46 AM
yes that does not work. try this.


var treepanel = sm.view.panel;

maneljn
31 Jul 2012, 11:49 PM
That works fine.

Thanks.
Manel