I've created a panelbar in the Layout:
@(Html.Kendo().Splitter()
.Name("mainsplitter") //The name of the splitter is mandatory. It specifies the "id" attribute of the widget.
.Panes(panes =>
{
panes.Add().Content(@<text>@Html.Action("_Panelbar")</text>)
.Resizable(true)
.Size("20%");
panes.Add().Content(@<text>
<section class="content-wrapper main-content clear-fix">
@RenderBody()
</section>
</text>); //Add pane
})
)
And a rendersection for the main content, it all goes well, but when I
change the main content Model, the panelbar jumps to the first item.
When I return only the ViewBag, and no Model, the panelbar is keeping
the selected item.
What have I to do for keep always the selected item ?
And in the _PanelbarView:
@model CPMPlanning.Models.CPMModelViewPanel
@( Html.Kendo().PanelBar()
.Name("PanelBar")
.SelectedIndex(Model.ObjectIDSelected)
.ExpandMode(PanelBarExpandMode.Single)
.BindTo(Model.ObjectTypes, mappings =>
{
mappings.For<CPMPlanning.Models.ObjectTypeView>(binding => binding
.ItemDataBound((item, objecttype) =>
{
item.Text = objecttype.ObjectTypeDesc;
})
.Children(o => o.Objects));
mappings.For<CPMPlanning.Models.ObjectView>(binding => binding
.ItemDataBound((item, obj) =>
{
item.Text = obj.ObjectCode;
item.Url = Url.Action("Index", "CPMModel", new { id = obj.ObjectID });
})
);
})
)
@(Html.Kendo().Splitter()
.Name("mainsplitter") //The name of the splitter is mandatory. It specifies the "id" attribute of the widget.
.Panes(panes =>
{
panes.Add().Content(@<text>@Html.Action("_Panelbar")</text>)
.Resizable(true)
.Size("20%");
panes.Add().Content(@<text>
<section class="content-wrapper main-content clear-fix">
@RenderBody()
</section>
</text>); //Add pane
})
)
And a rendersection for the main content, it all goes well, but when I
change the main content Model, the panelbar jumps to the first item.
When I return only the ViewBag, and no Model, the panelbar is keeping
the selected item.
What have I to do for keep always the selected item ?
And in the _PanelbarView:
@model CPMPlanning.Models.CPMModelViewPanel
@( Html.Kendo().PanelBar()
.Name("PanelBar")
.SelectedIndex(Model.ObjectIDSelected)
.ExpandMode(PanelBarExpandMode.Single)
.BindTo(Model.ObjectTypes, mappings =>
{
mappings.For<CPMPlanning.Models.ObjectTypeView>(binding => binding
.ItemDataBound((item, objecttype) =>
{
item.Text = objecttype.ObjectTypeDesc;
})
.Children(o => o.Objects));
mappings.For<CPMPlanning.Models.ObjectView>(binding => binding
.ItemDataBound((item, obj) =>
{
item.Text = obj.ObjectCode;
item.Url = Url.Action("Index", "CPMModel", new { id = obj.ObjectID });
})
);
})
)