How to sort alphabetically kendotabStrip after append

270 views Asked by At

This is my code

var tabStrip = $("#createPackageRoomType ul").kendoTabStrip().data("kendoTabStrip");

tabStrip.append({ text: $(this).attr('label'), content: $('#createPackageRoomTaskList').val() });
tabStrip.select((tabStrip.tabGroup.children("li").length - 1));
tabStrip.tabGroup.children("li.k-state-active").attr("id",$(this).attr('label')+"_"+$(this).attr('value'));
tabStrip.tabGroup.children("li.k-state-active").attr("value",$(this).attr('value'));
tabStrip.tabGroup.children("li.k-state-active").attr("label",$(this).attr('label'));"checkedCheckbox(\"'$(this).attr('value')'\")"
tabStrip.tabGroup.children("li.k-state-active").attr("onclick",'checkedCheckbox(\"'+$(this).attr('value')+'\");');
1

There are 1 answers

0
Jarosław Kończak On

Use this function:

function sortTabs(tabStripId){
    var tabstrip = $("#" + tabStripId).data("kendoTabStrip");
    tabstrip.tabGroup.children().sort(function(a, b){
          return $(a).find('.k-link').text() > $(b).find('.k-link').text() ? 1 : -1;
    }).each(function(ind, val){
        tabstrip.tabGroup.append(val);
    });
}

Kendo dojo example: http://dojo.telerik.com/udaNe