我的其中一个页面中有一个 dojo.datagrid 。 Datagrid 及其存储(通过调用 URL)是通过声明性方法创建的。不是通过动态/程序化。
我需要执行一个 javascript 方法,该方法在我的数据网格下方显示一个 div(需要来自数据网格的少量数据)。我应该仅在数据网格加载完成后显示 div;而不是在此之前。
我正在寻找诸如数据网格 onload 完成之类的事件。 dojo.datagrid 有什么活动吗?我在 dojo.Datagrid 文档的事件列表中没有看到它。
有没有办法检查 dojo datagrid onload 是否完成?
有没有办法使用 dojo.connect 来处理这个问题?
如果我们有什么办法可以做到这一点,请告诉我...
谢谢,
拉杰.
I have a dojo.datagrid in one of my pages. Datagrid and its store(by calling an URL) are created by declarative method. not by dynamic/programmatic.
I need to execute a javascript method which displays a div(which requires few data from the datagrid) just below my datagrid. I should display the div only after my datagrid loading completed;not before that.
I am looking for event like onload completed for datagrid. Is there any event do we have with dojo.datagrid? I don't see it in the event's list of dojo.Datagrid documentation.
Is there a way to check dojo datagrid onload completed?
Is there any way to use dojo.connect to handle this?
Please let me know if we have any way to do this...
Thanks,
Raj.
发布评论
评论(4)
数据网格本身从未真正加载所有可用数据,它仅显示其存储中数据的子选择。
您需要绑定商店事件才能捕获 onload 事件。由于存储可以从很多地方加载数据,因此您需要将 onComplete 函数传递给网格存储的 fetch 方法。
您还可以以编程方式创建存储,使用 onComplete 侦听器调用 fetch,并在完成对存储的 onComplete 侦听器中的项目的修改后,调用 myGrid.setStore(myStore);
The datagrid itself never actually loads all of the data available, it is only showing a sub selection of the data in its store.
You will need to tie into the store events in order to catch the onload event. Since the store can load data from lots of places, you will need to pass an onComplete function to the fetch method of the grid store.
You could also create the store programatically, call fetch with your onComplete listener, and once you have finished the modification of the items in the store's onComplete listener, call myGrid.setStore(myStore);
DataGrid
有一个事件_onFetchComplete
,您可以使用dojo.connect
连接到该事件。请注意,它以_
开头,因此它应该是一种私有/受保护的事件,并且其行为可能会在较新的 Dojo 版本中发生变化。我知道它在 Dojo 1.6 中运行良好。The
DataGrid
has an event_onFetchComplete
which you could connect to withdojo.connect
. Note that it starts with_
though, so it's supposed to be a private/protected kind of event and its behaviour could change in newer Dojo versions. I know it works well in Dojo 1.6.正如 Alex 已经指出的那样,您可以对(不幸的是)私有
_onFetchComplete
事件做出反应。在 dojo 1.7 中,这可以通过 dojo.aspect 来实现,例如:As Alex already pointed out, you can react to the (unfortunately) private
_onFetchComplete
event. With dojo 1.7, this can be achieved with dojo.aspect like:您可以设置一个计时器来检查数据是否已加载,每隔一秒左右运行一次,直到加载完成(setSelectedIndex 将返回 true):
You can set up a timer to check if the data is loaded, run every second or so until the load is complete (setSelectedIndex will return true):