Hello!
I'm developing a MVC4 application and having some trouble with the panel bar. Every time an item is expanded, i need that it's contents get reload from a partial view.
When the panel bar is initialized I set its datasource to the result of an AJAX call that returns JSON with the need properties to populate the panelbar dynamically, and it it's working nicely. The content url comes already prepared in this datasource.
Then I hook up to the select (or expand) event of the panel bar so that I call the reload method. The thing happening is that when the reload method is invoked, partial view get's loaded to the request. The images help to understand this.
Some code:
To get datasource and populate the panelbar
To refresh the contents
Am I missing something here??
I'm developing a MVC4 application and having some trouble with the panel bar. Every time an item is expanded, i need that it's contents get reload from a partial view.
When the panel bar is initialized I set its datasource to the result of an AJAX call that returns JSON with the need properties to populate the panelbar dynamically, and it it's working nicely. The content url comes already prepared in this datasource.
Then I hook up to the select (or expand) event of the panel bar so that I call the reload method. The thing happening is that when the reload method is invoked, partial view get's loaded to the request. The images help to understand this.
Some code:
To get datasource and populate the panelbar
$.getJSON(
'@Url.Action("GetGrupos", "RegistoFCPlano")/?tipoGrupo=2&data='
+ $(
"#datepicker"
).val() +
'&cg1='
+ codGrupo)
.done(
function
(json) {
var
panelItems = $.map(json,
function
(obj) {
return
{
text: obj.Codigo,
expand:
true
,
contentUrl: obj.Conteudo
};
});
$(
"#panelbar"
).kendoPanelBar({
dataSource: panelItems,
expandMode:
"single"
,
id:
"Codigo"
,
select: refreshContent
}).data(
"kendoPanelBar"
);
})
.fail(
function
(jqxhr, textStatus, error) {
var
err = textStatus +
", "
+ error;
console.log(
"Request Failed: "
+ err);
});
To refresh the contents
var
refreshContent =
function
() {
var
panelBar = $(
"#panelbar"
);
var
item = panelBar.select();
panelBar.reload(item[0]);
};
Am I missing something here??