JavaScript / ExtJs : TreePanel / TreeLoader : how to handle load errors?
Almost everything is in the title ;)
When you create a TreePanel you can add a loader this way:
loader: ne开发者_StackOverflow社区w Ext.tree.TreeLoader({
dataUrl: '../myurl.php'
});
But how to handle load errors?
For example if the user is not connected I want to display a Login box.
I can't find an example showing how to handle loading errors with TreeLoader
and/or TreePanel
.
Try finding the answer here;
http://www.extjs.com/forum/showthread.php?t=2072
Okay I found the solution: listeners.
Here's my code, I hope this will help someone!
loader: new Ext.tree.TreeLoader({
dataUrl: 'my_get_datas.php',
listeners: {
loadexception: function(tl, node, response) {
if (response
new WindowLoginPanel().show();
}
}
}),
精彩评论