Skip to content
Browse files

Adding a callback for closing the tab

Users of ui.tabs.closable may want the option of providing a callback
function to determine whether or not it's right to close the tab based
on an application's policies. If no call back is provided the
functionality remains the same as before.
  • Loading branch information...
1 parent dc6b72b commit ef6ce304ad682d098003d3b6181e25e49b9678e3 Corey Olsen committed with
Showing with 3 additions and 0 deletions.
  1. +3 −0 ui.tabs.closable.js
View
3 ui.tabs.closable.js
@@ -41,6 +41,9 @@ $.extend($.ui.tabs.prototype, {
.click(function() {
var index = self.lis.index($(this).parent());
if (index > -1) {
+ // call _trigger to see if remove is allowed
+ if (false === self._trigger("closableClick", null, self._ui( $(self.lis[index]).find( "a" )[ 0 ], self.panels[index] ))) return;
+
// remove this tab
self.remove(index)
}

0 comments on commit ef6ce30

Please sign in to comment.
Something went wrong with that request. Please try again.