Extjs 6.5 Treestore not loading data from server

705 Views Asked by At

I'm migrating a small app from Extjs4 to 6.5. The problem is the treestore, which is very simple, but I cannot find out why the server routine is not called and also the exception-events are not called. I must overlook something, but I cannot find it. The tree store is:

Ext.create("Ext.data.TreeStore", {
fields: ['mnu_Name'],
proxy: {
    type: 'ajax',
    headers: { "Content-Type": 'application/json' },
    api: { read: '/Secure/WebServices/PageLayout.asmx/LoadMenuII' },
    reader: {
        type: 'json',
        root: function (o) {
            if (o.d) {
                return o.d.data;
            } else {
                return o.children;
            }
        }
    },
    listeners: {
        exception: function () {
            alert('exception');
        }
    }
},
listeners: {
    exception: function () {
        alert('exception');
    }
}
});

When I call the server routine with a plain Ajax call is works fine.

Ext.Ajax.request({
    async: true,
    url: '/Secure/WebServices/PageLayout.asmx/LoadMenuII',
    headers: { 'Content-Type': 'application/json' },
    success: function (response, options) {
        //Extract data from the response
        var data = Ext.decode(response && response.responseText || null, true);

        //check op success=false
        if (!data || data.success !== true) {
            var errNumber = data && data.errNumber || 'Unknown',
                errDescription = data && data.errDescription || 'Unknown';
            Ext.Msg.alert("Warning", Ext.String.format(thisComp.errFormat, 'Warning in loading the menu definitione.', errNumber, errDescription), null, this, 9000)
            return;
        }               

    }
});

Any suggestion what I missed?

Thanks.

Arno

0

There are 0 best solutions below