Greetings!
I've implemented an EditorTemplate that uses Kedno.DropDownList for one of the model properties. Here is an example of it
1.
@(Html.Kendo().DropDownList()
2.
.Name(ViewData.ModelMetadata.AdditionalValues[
"id"
].ToString())
3.
.OptionLabel(
"not selected"
)
4.
.DataTextField(
"Name"
)
5.
.DataValueField(
"Id"
)
6.
.DataSource(ds => ds.Read(a => a.Action(
"GetAvailiableOrders"
,
"Orders"
)))
7.
.Filter(FilterType.Contains)
8.
I use this model to populate grid, like so
01.
@(
02.
Html.Kendo().Grid<CustomerViewModel>()
03.
.Name(
"customersGrid"
)
04.
.ToolBar(toolbar =>
05.
{
06.
if
(!Model.ReadOnly)
07.
{
08.
toolbar.Create();
09.
}
10.
})
11.
.Editable(e => e.Mode(GridEditMode.InLine).CreateAt(GridInsertRowPosition.Bottom))
12.
.Resizable(resize => resize.Columns(
true
))
13.
.Columns(c => {
14.
c.Bound(s => s.Order);
//EditorTemplate will be used here
15.
c.Bound(s => s.ConsumerName).Format(
"{0:dd.MM.yyyy}"
);
16.
c.Bound(s => s.OrderDate).Format(
"{0:dd.MM.yyyy}"
);
17.
if
(!Model.ReadOnly)
18.
{
19.
c.Command(command =>
20.
{
21.
command.Edit();
22.
command.Destroy();
23.
});
24.
}
25.
})
26.
.DataSource(d => d.Ajax().
27.
Model(m =>
28.
{
29.
m.Id(p => p.Id);
30.
m.Field(p => p.Id).DefaultValue(
default
(
long
));
31.
})
32.
.Read(a => a.Action(
"GetCostumers"
,
"Costumers"
))
33.
.Create(a => a.Action(
"CreateCostumer"
,
"Costumers"
))
34.
.Update(a => a.Action(
"UpdateCostumer"
,
"Costumers"
))
35.
.Destroy(a => a.Action(
"DeleteCostumer"
,
"Costumers"
))
36.
)
37.
)
I need some how to pass additional argument to the DataSource Read method,this parameter depends on other model property an is uiniqe for each grid row.
.DataSource(ds => ds.Read(a => a.Action(
"GetAvailiableOrders"
,
"Orders"
)))
//Need to pass additional argument here dependting on current row
Is there any way to implement this?