mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Fix bug where last tab being removed, didn't update tabset input value
This commit is contained in:
committed by
Barbara Borges Ribeiro
parent
91dbb0e77b
commit
c090efd562
@@ -5101,14 +5101,23 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
||||
},
|
||||
setValue: function setValue(el, value) {
|
||||
var self = this;
|
||||
var anchors = $(el).find('li:not(.dropdown)').children('a');
|
||||
anchors.each(function () {
|
||||
if (self._getTabName($(this)) === value) {
|
||||
$(this).tab('show');
|
||||
return false; // Break out of each()
|
||||
}
|
||||
return true;
|
||||
});
|
||||
var success = false;
|
||||
if (value) {
|
||||
var anchors = $(el).find('li:not(.dropdown)').children('a');
|
||||
anchors.each(function () {
|
||||
if (self._getTabName($(this)) === value) {
|
||||
$(this).tab('show');
|
||||
success = true;
|
||||
return false; // Break out of each()
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
if (!success) {
|
||||
// This is to handle the case where nothing is selected, e.g. the last tab
|
||||
// was removed using removeTab.
|
||||
$(el).trigger("change");
|
||||
}
|
||||
},
|
||||
getState: function getState(el) {
|
||||
return { value: this.getValue(el) };
|
||||
@@ -5117,7 +5126,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
||||
if (data.hasOwnProperty('value')) this.setValue(el, data.value);
|
||||
},
|
||||
subscribe: function subscribe(el, callback) {
|
||||
$(el).on('shown.bootstrapTabInputBinding shown.bs.tab.bootstrapTabInputBinding', function (event) {
|
||||
$(el).on('change shown.bootstrapTabInputBinding shown.bs.tab.bootstrapTabInputBinding', function (event) {
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
inst/www/shared/shiny.min.js
vendored
2
inst/www/shared/shiny.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -11,15 +11,24 @@ $.extend(bootstrapTabInputBinding, {
|
||||
return null;
|
||||
},
|
||||
setValue: function(el, value) {
|
||||
var self = this;
|
||||
var anchors = $(el).find('li:not(.dropdown)').children('a');
|
||||
anchors.each(function() {
|
||||
if (self._getTabName($(this)) === value) {
|
||||
$(this).tab('show');
|
||||
return false; // Break out of each()
|
||||
}
|
||||
return true;
|
||||
});
|
||||
let self = this;
|
||||
let success = false;
|
||||
if (value) {
|
||||
let anchors = $(el).find('li:not(.dropdown)').children('a');
|
||||
anchors.each(function() {
|
||||
if (self._getTabName($(this)) === value) {
|
||||
$(this).tab('show');
|
||||
success = true;
|
||||
return false; // Break out of each()
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
if (!success) {
|
||||
// This is to handle the case where nothing is selected, e.g. the last tab
|
||||
// was removed using removeTab.
|
||||
$(el).trigger("change");
|
||||
}
|
||||
},
|
||||
getState: function(el) {
|
||||
return { value: this.getValue(el) };
|
||||
@@ -29,7 +38,7 @@ $.extend(bootstrapTabInputBinding, {
|
||||
this.setValue(el, data.value);
|
||||
},
|
||||
subscribe: function(el, callback) {
|
||||
$(el).on('shown.bootstrapTabInputBinding shown.bs.tab.bootstrapTabInputBinding', function(event) {
|
||||
$(el).on('change shown.bootstrapTabInputBinding shown.bs.tab.bootstrapTabInputBinding', function(event) {
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user