开发者

JavaScript / ExtJs : TreePanel / TreeLoader : how to handle load errors?

开发者 https://www.devze.com 2022-12-18 06:52 出处:网络
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({

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();
        }
    }
}),
0

精彩评论

暂无评论...
验证码 换一张
取 消