I have inline grid, I want to edit one field if the model.ebs is true or edit another field if the model.ebs is false.
@(Html.Kendo().Grid<
ViewModels.Payment.ProviderServiceRRViewModel
>()
.Name("PRRServiceGrid")
.Columns(columns =>
{
columns.Bound(p => p.Id).Hidden(true);
columns.Bound(p => p.IsEbsOnly).Hidden(true);
columns.Bound(p => p.ServiceName);
columns.Bound(p => p.Units);
columns.Bound(p => p.ReduceUnits);
columns.Bound(p => p.ReimbursementAmount).Format("{0:c}");
columns.Command(command =>
{
command.Edit().HtmlAttributes(new { @class = "btn-primary k-grid-edit" });
})
.Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(5))
.Sortable()
.Selectable()
.Events(e => e.Edit("onPRRServiceGridEdit"))
.Resizable(resize => resize.Columns(true))
.DataSource(dataSource => dataSource.Ajax().ServerOperation(false).PageSize(5).Read(read => read.Action("PrrServiceGridRead", "ReimbursementRequest", new { prrId = @Html.Raw(Json.Encode(Model.PrrId)), serviceType = @Html.Raw(Json.Encode(Model.ServiceType)) }))
.Model(model =>
{
model.Id(p => p.Id); model.Field(p => p.Id).Editable(false);
model.Field(p => p.ServiceName).Editable(false); //I did not make Units, reduce units column editable false
model.Field(p => p.ReimbursementAmount).Editable(false);
})
.Update(update => update.Action("Update_PrrServiceGrid", "ReimbursementRequest"))
))
function onPRRServiceGridEdit(e) {
var isEbsOnly = e.model.IsEbsOnly;
if(isEbsOnly) //I made it disable but I want to close the cell. I dont want to make it editable if the value is true
$(e.container).find('input[name="ReduceUnits"]').attr("disabled", true);
else
$(e.container).find('input[name="Units"]').attr("disabled", true);
}