I have kendo treeview to show history list, so initially I have 1 item then load its children from remote data.
Here is my razor code :
So technically when this "History" item being clicked it will call datasource read action and load its children items from controller. Yet its produce an error in console instead of calling the controller.
error image
Here is my controller code and the class that I return to client
any suggestion to fix this? Thanks
Here is my razor code :
01.
@(Html.Kendo().TreeView()
02.
.Name("tvHistory")
03.
.Animation(animation => animation.Expand(open =>
04.
{
05.
open.Expand(ExpandDirection.Vertical);
06.
open.Fade(FadeDirection.In);
07.
}))
08.
.Items(treeview => treeview.Add().Text("History").Id(Model.Id.ToString()))
09.
.DataTextField("Description")
10.
.AutoBind(false)
11.
.DataSource(dataSource => dataSource.Read(read => read.Action("History", "Reservation")))
12.
)
So technically when this "History" item being clicked it will call datasource read action and load its children items from controller. Yet its produce an error in console instead of calling the controller.
error image
Here is my controller code and the class that I return to client
01.
[HttpGet]
02.
public
ActionResult History(
int
id)
03.
{
04.
IList<ReservationHistory> histories = _reservationService.GetHistoryFor(id).DataList;
05.
IList<ReservationHistoryViewModel> viewModels = histories.ToModel<ReservationHistory, ReservationHistoryViewModel>();
06.
07.
return
Json(viewModels, JsonRequestBehavior.AllowGet);
08.
}
09.
10.
public
class
ReservationHistoryViewModel
11.
{
12.
public
int
Id {
get
;
set
; }
13.
public
int
ReservationId {
get
;
set
; }
14.
public
string
Description {
get
;
set
; }
15.
}
any suggestion to fix this? Thanks