双击图标,弹出窗口和后退屏幕都变淡
On double click to an icon, popup and back screen both are getting faded
我们正在使用 backbone 动态 forms.I 有一个文本字段,单击该字段时,会打开一个弹出窗口。这是我的功能。
但是双击那个字段屏幕变暗并且无法返回。必须再次打开新的 window 才能工作。
解决方案必须支持任何浏览器,主要是Chrome、Firefox、IE
使用计数变量我们可以解决这个问题。只需按照以下步骤操作:
1. 将count变量初始化为0.
2.如果count为0,则只触发lookup事件
3. 将 count 变量设置为 1 on click to field,触发事件显示 lookup
4. 在靠近查找面板时再次将计数设为 0。
示例代码:
## MainFormView.js ##
count:0,
initialize: function (options) {this.count = 0;},
events: {
'click #lookupId': 'showLookup'
},
showLookup: function (e) {
e.stopPropagation();
if(this.count == 0){
this.count = 1;
this.trigger("show:list");
}
}
### LookupView.js ###
lookupView: null,
initialize: function (options) {
this.lookupView= options.renderedFormView;
},
closePanel: function() {
this.lookupView.count = 0;
}
## MainController.js ##
mainFormView.on("show:list", function () {
var lookupView = new LookupView({
model: staffList,
renderedFormView: mainFormView
});
});
我们正在使用 backbone 动态 forms.I 有一个文本字段,单击该字段时,会打开一个弹出窗口。这是我的功能。
但是双击那个字段屏幕变暗并且无法返回。必须再次打开新的 window 才能工作。
解决方案必须支持任何浏览器,主要是Chrome、Firefox、IE
使用计数变量我们可以解决这个问题。只需按照以下步骤操作:
1. 将count变量初始化为0.
2.如果count为0,则只触发lookup事件
3. 将 count 变量设置为 1 on click to field,触发事件显示 lookup
4. 在靠近查找面板时再次将计数设为 0。
示例代码:
## MainFormView.js ##
count:0,
initialize: function (options) {this.count = 0;},
events: {
'click #lookupId': 'showLookup'
},
showLookup: function (e) {
e.stopPropagation();
if(this.count == 0){
this.count = 1;
this.trigger("show:list");
}
}
### LookupView.js ###
lookupView: null,
initialize: function (options) {
this.lookupView= options.renderedFormView;
},
closePanel: function() {
this.lookupView.count = 0;
}
## MainController.js ##
mainFormView.on("show:list", function () {
var lookupView = new LookupView({
model: staffList,
renderedFormView: mainFormView
});
});