【问题标题】:Extjs TreeStore, more than one asynchronous requests, treepanel rendering dislocationExtjs TreeStore,多个异步请求,treepanel渲染错位
【发布时间】:2019-12-02 17:31:47
【问题描述】:

我的 extjs 版本是 6.5,我创建了一个 treepanel 和 GridPanel。当我点击GridPanel中的记录时,会触发treepanel的treeStore来加载数据。如果我单击第一条记录,TreeStore 会加载更多数据并变慢,但我已经单击了第二条记录。同时,第二次点击请求已经响应。因此,treepanel 会渲染第一次点击的响应数据。

Ext.data.store 没有这个问题。我该如何解决这个问题?

【问题讨论】:

  • 你能制作一个小提琴 (fiddle.sencha.com) 来演示这个问题吗?我们确实需要查看代码和事件处理程序以了解发生了什么。

标签: extjs extjs6 extjs6.5 treestore


【解决方案1】:

你可以在 treestore 上监听 load 事件 https://docs.sencha.com/extjs/6.5.3/modern/Ext.data.Store.html#event-load

并切换 grid.disableSelection(true);基于选择状态 https://docs.sencha.com/extjs/6.5.3/modern/Ext.grid.Grid.html#cfg-disableSelection

【讨论】:

  • 是的,我在grid beforeselect事件前监听,当treestore的isLoading方法返回true时,返回false停止grid的select事件
【解决方案2】:

不要一次执行多个加载请求。 mask 点击网格,unmask 加载商店时。

【讨论】:

    猜你喜欢
    • 2013-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-17
    • 1970-01-01
    • 2012-05-26
    • 2018-04-10
    • 1970-01-01
    相关资源
    最近更新 更多