jQuery UI Widgets › Forums › Navigation › Tabs › Prevent tab close
This topic contains 12 replies, has 6 voices, and was last updated by fdski 9 years, 2 months ago.
-
AuthorPrevent tab close Posts
-
Hello,
I’m just learning to use jqWidgets, and I have a problem for what I don’t find any solution.
I want to prevent the closing of a certain tab in case of:
#1. the user clicks on a tab to activate it, but it hits the close button by accident
#2. I have a form in a tab which is modified but not yet saved.
Is there any event that fires before the tab being closed so that I can prevent the closing?Thanks.
Hello flevi,
Unfortunately, there is no such event in the jqxTabs API.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Any plans to add such an event in the near future?
Thank you.
Hi flevi,
We currently have no plans to add this functionality.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi flevi,
I’ve similar problem… I suggest to you to implemente a javascript function to prevent this kind of problem..Hi Dimitar, fox82i,
I did try to put an onclick on the div that stands for the close button, but of course the tabs method runs first … so I have no solution to solve this, and I would need this framework for a big system where every form/grid/whatever is opened in a new tab (and the number of opened tabs will constantly exceed 20-25, so constantly navigating between that many tabs will easily result in accidentally closing a tab, instead of selecting it – and loosing unfinished forms is a problem), so this is a big issue for me … I guess I will either use the jQuery UI tab, or implement a custom tab script. If you have any easy solution I would appreciate it. Thanks again.Flevi,
wait me I come from other framework and I discovered this recently.
I need to study before to produce somenthingI have the same problem, but i solved with a little trick:
1. Attach to mousedown event of .jqx-tabs-close-button. I call jqxTabs addLast method first, then i call jquery mousedown method.
2. On mousedown event, for example do:if (confirm(“Close?”)) {
$(this).trigger(‘click’);
return true;
}
return falseWorks for me!
MGThanks mg, it works.
Great!, sometimes i love jqwidgets but other times i feel frustrated when i read: “We currently have no plans to add this functionality” many times i resolved problems like that with hacks and tricks. jqwidgets is a very good library but sometimes i feel frustrated….
Hello,
I’m a bit too late in this thread, but here comes my solution: I added a “beforeClose” event. If it returns false, tab closing is prevented.
Example has both initially rendered and dynamically created tabs.http://jsfiddle.net/howe/HzJ73/
Best Regards,
HoweBtw I meant “beforeRemove” event.
Howe
howe, i love you man (or woman) !!!
🙂
Thanks.
B
-
AuthorPosts
You must be logged in to reply to this topic.