简体   繁体   English

jQuery UI对话框:删除还是关闭?

[英]jquery ui dialog box: remove or close?

what is best practice when it comes to closing a jQuery UI dialog box? 关闭jQuery UI对话框的最佳实践是什么? I use a dialog box so the user can perform a search. 我使用一个对话框,以便用户可以执行搜索。

When the user is finished, should I use .close() or .remove()? 用户完成操作后,应该使用.close()还是.remove()?

My concern is, what if they decide to perform another search...would it be better to haved closed or removed the old one? 我担心的是,如果他们决定执行另一次搜索...最好关闭或删除旧搜索?

Thanks! 谢谢!

Closing and showing is much faster than removing and recreating, but if it matters to you, any previous user input will still be in the dialog if you simply save it and show it. 关闭和显示比删除和重新创建要快得多,但是如果对您来说很重要,那么只要您保存并显示它,任何以前的用户输入仍将出现在对话框中。

In my experience, the best thing to do is keep the dialog around, and initialize it before (re-)opening it. 以我的经验,最好的办法是保留对话框,并在(重新)打开它之前对其进行初始化。 This way, you keep adding or removing from the DOM to a minimum, and the initialize step gives you a chance to make sure the user sees what they're expecting to see. 这样,您就可以将DOM的添加或删除保持到最低限度,并且初始化步骤使您有机会确保用户看到了他们期望看到的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM