- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个可以进行实时搜索的输入字段。它被设置为每次按键时都会执行 store.findQuery 来触发 api 请求。我注意到在使用它时,我需要在执行每个新的 findQuery 时取消对 api 的挂起的 ajax 调用。由于搜索查询已更改,最终会出现大量不相关的请求。有谁知道该怎么做吗?
最佳答案
没有内置的方法可以做到这一点。对于这种类型的使用,ajax 调用本身不会返回给您。我建议消除您的查找请求,以避免发出大量无用的请求。
App.IndexController = Em.Controller.extend({
foo:undefined,
callsToSearch: 0,
actualSearch: 0,
watchFoo: function(){
this.incrementProperty('callsToSearch');
//context, method, time that must elapse before calling method
Em.run.debounce(this, this.doSearch, 300);
}.observes('foo'),
doSearch: function(){
this.incrementProperty('actualSearch');
// do the actual search here
}
});
关于javascript - 执行 findQuery emberjs 和 ember 数据时取消对 api 的现有调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24330310/
夹具包含联系人列表,每个联系人都有联系人类型。我正在尝试使用 .findQuery() 过滤联系人记录,但它抛出以下错误: Uncaught TypeError: Object function ()
我想知道为什么在使用 findQuery 获取数据时,我的模板在 createRecord 之后没有得到更新。 当更改此 return this.store.findQuery('timetracki
当我尝试通过简单地调用 this.store.find('article', { typeId: model.get('typeId') }) 加载文章时,我得到: Error while proce
正如标题所示,我收到的错误是: Error while processing route: index Assertion Failed: The response from a findQuery
我正在尝试编写我的第一个“真正的” ember 应用程序。我已经阅读了几个教程,现在我正在尝试将 ember 与 Ember Data 结合使用来从 Rails 应用程序中获取数据并显示它。 我已经得
我有一个可以进行实时搜索的输入字段。它被设置为每次按键时都会执行 store.findQuery 来触发 api 请求。我注意到在使用它时,我需要在执行每个新的 findQuery 时取消对 api
ember-data 中的 find、findAll 和 findQuery 有什么区别? 最佳答案 find是 findAll 的便利包装器, findQuery和 findById . findA
我是一名优秀的程序员,十分优秀!