我有一个MVC应用程序。其中一家商店的定义如下:

Ext.define('Instructions.store.InstructionsObjectTreeStore', {
    extend: 'Ext.data.TreeStore',
    requires: ['Instructions.model.InstructionsObjectTreeModel'],
    model: 'Instructions.model.InstructionsObjectTreeModel',
    autoLoad: false,
    proxy: {
        type: 'ajax',
        url: 'controller/InstructionsHandler.php',
        node: 'id',
        extraParams: {
            action: 'getInstructionsObjectTree'
        }
    },
    root: {
        text: 'Objects',
        id: 'src',
        root: true,
        expanded: true
    }
});


但是,据我在控制台中看到的,autoLoad被忽略。我也尝试过使用旧建议

root:{
    loaded: true
}


在我的treepanel定义中,但也没有帮助。那么,如何解决呢?

最佳答案

您似乎对docs的阅读太近了(通常很好),遵循了太多参考文献,甚至查看了示例。请在sencha论坛中报告文档示例中的严重错误。


  请务必注意,树存储将
  如果在根节点上将expand设置为true,则无论autoLoad的值如何,都可以加载。


这部分文档是完全正确的。所有其他(包括代码示例)都是错误的。

expand: false


应该按照此fiddle解决问题。

expanded: false


什么也没做,尽管几乎在其他地方都用过。

关于javascript - autoLoad:在ExtJs 6中忽略false,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35334467/

10-12 01:19