Extjs在Ex的JsonStore的load方法中使用回调callback
Ajax的异步请求有时候会带来一些问题,如在Ext做的页面中,需要加载一个JsonStore数据集,在紧跟着的代码中可能就会对数据集进行访问的操作,由于异步请求很可能导致数据未加载完就开始访问,结果可能会不是想要的结果。这里load方法中提供了一个callback回调函数,可以解决延迟加载的问题,我们需要处理的一部分代码可以放在callback函数中处理,这样就解决了异步请求带来的问题。如:
Java代码
继续阅读 »
Extjs中JSonStore的操作
I’m trying to get a jsonstore to read in data and parse it. It sounds simple enough, but for whatever reason, I am having a heck of a time doing it. I’ve boiled down my problem to the simplest example I can think of, but I’m still not getting it. Any ideas?
Here is the code. The idea is that when you click on the button, the JSON is parsed and an alert pops up with the name field from the record.
When I step through the code using Firebug, the “each” function on the datastore steps right over the alert, acting as if there are no records. 继续阅读 »
近期评论