Hi. I've faced similar problem. router.route fired twice. First time in StackTrace 'OnSelect' method, which is desired, but second time there is o.extend._urlChanged.
- How to prevent router.route double firing ?
- How to properly select tab via API?
<
script
>
var router = new kendo.Router({hashBang: true});
router.route("*suffix", function (suffix, e) {
console.log(suffix);
try {
var item = $("#tabstrip").tabGroup.find(':contains("' + suffix + '")');
$("#tabstrip").select(item);
} catch (ex) {
console.log(ex);
};
});
$(function () {
$('body').addClass('manageDashboards');
$('.k-tabstrip-wrapper').addClass('tabsDashboards');
router.start();
viewModel = dashboardViewModel(@Html.Raw(Json.Encode(Model)));
kendo.bind($("#dashboards"), viewModel);
});
function onSelect(e) {
kendo.ui.progress($("#tabstrip"), true);
viewModel.set("SelectedTab", $(e.item).index());
router.navigate($(e.item).text());
}
</
script
>
@(Html.Kendo().TabStrip()
.Name("tabstrip")
.Navigatable(false)
.Events(e => e.Select("onSelect").Activate("onActivated"))
.Items(tabstrip =>
{
foreach (var dashboard in Model)
{
tabstrip.Add().Text(dashboard.Name)
.Selected(dashboard.Type == DashboardType.Global)
.Content(@<
text
>
@Html.EditorFor(model => dashboard)
</
text
>);
}
}))
Video: http://screencast.com/t/wI4iQITaUxGn