[英]View page is locked/disabled after closing Bootstrap modal dialog
This problem is driving me crazy now.这个问题现在让我发疯。 Here is the sequence and code I am doing:这是我正在做的序列和代码:
I am using Backbone (Chaplin) JS, jQuery and Handlebars我正在使用 Backbone (Chaplin) JS、jQuery 和 Handlebars
Fill some information, click the "Save" button on the modal dialog.填写一些信息,点击模态对话框上的“保存”按钮。
In the button click handler function, insert the record for a table row to model data something like:在按钮单击处理函数中,插入表行的记录以对数据进行建模,例如:
this.model.tabledata.push(new_record); this.model.tabledata.push(new_record);
this.render(); this.render();
Call render to refresh the view with updated model data调用 render 以使用更新的模型数据刷新视图
Result and Problem:结果和问题:
What is the issue and how to fix?这是什么问题以及如何解决? Please help!请帮忙!
Finally I figured out a way to fix my problem.最后我想出了一种方法来解决我的问题。 The code is as following:代码如下:
$('#myModal').modal('hide');
$('#myModal').on('hidden.bs.modal', function () {
_this.render();
})
Basically I need to wait for the dialog completely closed before rendering the parent view page.基本上我需要在渲染父视图页面之前等待对话框完全关闭。 Not sure exactly why but this works.不确定为什么,但这有效。 Hopefully somebody can help answer.希望有人能帮忙解答。 I guess this has something to do with fired event sequence.我想这与触发事件序列有关。
I had similar problem.我有类似的问题。 I found, that bootstrap on modal show create a div-layer with a class "modal-backdrop".我发现,模态显示的引导程序创建了一个带有“模态背景”类的 div 层。 so if you want to return to the page and enable the page again do the following:因此,如果您想返回该页面并再次启用该页面,请执行以下操作:
hide the modal with: $('#modalId').modal('hide');
隐藏模式: $('#modalId').modal('hide');
remove the div layer: $(".modal-backdrop").remove();
删除 div 层: $(".modal-backdrop").remove();
I hope this answer helps我希望这个答案有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.