PDA

View Full Version : treepanel.expandPath(..., { callback: function() { } }); not working



Elfayer
23 Oct 2012, 4:08 AM
Hi,
I'm trying to call the callback function after an expandPath(), but it doesn't work.


treePanel.expandPath(treePanel.getSelectionModel().getSelection()[0].getPath(), {
callback: function () {
treePanel.getSelectionModel().select(treePanel.getStore().getNodeById(record.data.fil_id));
}
});

James Goddard
23 Oct 2012, 4:43 AM
expandPath takes a callback function, not an object. Also the callback is the 4th param, not the second.:



expandPath (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.tree.Panel-method-expandPath)( path, [field], [separator], [callback], [scope] )

James Goddard
23 Oct 2012, 6:10 AM
Ok, so what am I suppose to do with the [field] and the [separator]?

I would suggest (in order of likelihood to actually work):

1. Appropriate values
2. Default values:
3. Undefined
4. null

Why don't you try:


expandPath (
'foo/bar', // 1st paremeter is the path
'id', // 2nd parameter is field in model that makes up path
'/', // 3rd paremeter is path separator
function (success, lastNode) {
//do something
}, // 4th paramter is FUNCTION
this // 5th paramter is scope
);


P.S: To sencha. You really shouldn't let people delete posts, it makes threads very disjointed.