dojox / mobile / SearchBox'onSearch'事件在webkit上运行两次 [英] dojox/mobile/SearchBox 'onSearch' event runs twice on webkit

查看:130
本文介绍了dojox / mobile / SearchBox'onSearch'事件在webkit上运行两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Dojo 1.9。
事实上,onSearch事件在Safari和Chrome中运行两次,而不是一次。在Firefox中它运行正常。

  SearchBox.onSearch = function(){
console.log(it run );
}

我需要运行一次。我该怎么办?



这个 jsfiddle

解决方案

我认为您在不支持的情况下使用SearchBox,那就是没有指定其store财产或其列表属性。



我已经在这里: http:/ /jsfiddle.net/adrian_vasiliu/g4yLQ/2/ 修改后的代码变体。通过设置store属性(这里是一个空的dojo / store / Memory):

  var store = new Memory(); // empty store 
var sb = new SearchBox({store:store,...});

我得到onSearch()只调用一次(在Chrome32 / Win7中测试)。由于在实践中,SearchBox应该与商店一起使用,我不认为这真的是一个错误。


I'm using Dojo 1.9. It happens that the onSearch event runs twice instead of once in Safari and Chrome. In Firefox it runs OK.

SearchBox.onSearch = function(){
    console.log("it ran");
}

I need it to run once. How can I manage to do that?

This jsfiddle reproduce this issue.

解决方案

I think you are using the SearchBox in an unsupported case, that is without specifying its "store" property nor its "list" property.

I've put here: http://jsfiddle.net/adrian_vasiliu/g4yLQ/2/ a modified variant of your code. By setting the store property (here, to an empty dojo/store/Memory):

var store = new Memory(); // empty store
var sb = new SearchBox({store: store, ...});

I get onSearch() called only once (tested in Chrome32/Win7). Since in practice SearchBox is supposed to be used with a store, I don't think this is really a bug.

这篇关于dojox / mobile / SearchBox'onSearch'事件在webkit上运行两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆