Code for adding and selecting a new tab:
var tabs = $('#tabs').data('kendoTabStrip'); var tabNum = tabs.items().length; var closeButton = "<span unselectable='on' class='k-icon k-delete'>delete</span>"; tabs.append( { encoded: false, //allow HTML text: team.name + ' ' + closeButton, contentUrl: 'teamschedule.html' }); // make new tab the active tab tabs.select(tabNum); var tab = $(tabs.items()[tabNum]); //attach delete handler to the delete icon tab.on('click','.k-delete', tab, $scope.removeTab);
Here is the code to delete the tab and select the previous one (if the remote tab was selected):
$scope.removeTab = function(e) { var tabs = $('#tabs').data('kendoTabStrip'); if (e.data.hasClass('k-state-active')) {
I use angular, therefore using $ scope.
source share