I have a grid where I am trying to allow users to Update a Boolean value with a dropdown list. The grid displays correctly, and when I change the value of the dropdown list and click Update, the grid displays the correct value. All the other fields are updated to the new values and sent through to the controller correctly, but the new value set by the custom editor is still the old value.
<
script
>
function GridBooleanEditor(container, options) {
$('<
input
required
name
=
"' + options.field + '"
/>')
.appendTo(container)
.kendoDropDownList({
dataSource: {
data: [
{ text: "True", value: true },
{ text: "False", value: false }
]
},
dataTextField: "text",
dataValueField: "value",
valuePrimitive: true
});
}
function ClassificationSchemeEnabledTemplate(data) {
var iconClass = data.IsVisible ? 'k-i-check' : 'k-i-close';
return '<
span
class
=
"k-icon ' + iconClass + '"
></
span
>';
}
</
script
>
<
kendo-datasource
name
=
"schemeDataSource"
type
=
"DataSourceTagHelperType.Ajax"
page-size
=
"20"
server-operation
=
"true"
on-error
=
"DataSourceError"
>
<
transport
>
<
read
url
=
"@Url.ActionLink("
_ReadSchemes", "ControlPanel")"
type
=
"POST"
/>
<
update
url
=
"@Url.Action("
_UpdateScheme", "ControlPanel")"
type
=
"POST"
/>
</
transport
>
<
schema
>
<
model
id
=
"FolderID"
>
<
fields
>
<
field
name
=
"FolderID"
type
=
"number"
></
field
>
<
field
name
=
"Name"
type
=
"string"
></
field
>
<
field
name
=
"Description"
type
=
"string"
></
field
>
<
field
name
=
"IsVisible"
type
=
"boolean"
></
field
>
</
fields
>
</
model
>
</
schema
>
</
kendo-datasource
>
<
kendo-grid
name
=
"schemegrid"
datasource-id
=
"schemeDataSource"
style
=
"height:100%;"
>
<
editable
mode
=
"inline"
enabled
=
"true"
/>
<
sortable
enabled
=
"true"
/>
<
pageable
button-count
=
"5"
refresh
=
"true"
page-sizes
=
"new int[] { 5, 10, 20 }"
>
</
pageable
>
<
columns
>
<
column
field
=
"FolderID"
title
=
"Folder ID"
hidden
=
"true"
></
column
>
<
column
field
=
"Name"
title
=
"Name"
></
column
>
<
column
field
=
"Description"
title
=
"Description"
></
column
>
<
column
field
=
"IsVisible"
title
=
"Enabled"
editor
=
"GridBooleanEditor"
template
=
"#=ClassificationSchemeEnabledTemplate(data)#"
></
column
>
<
column
>
<
commands
>
<
column-command
name
=
"edit"
></
column-command
>
</
commands
>
</
column
>
</
columns
>
</
kendo-grid
>