Hi;
I've got a grid and I want to have a custom editor in one column under certain conditions, and have no editor under other conditions. Building the editor without the conditions is trivial, but I cannot figure out how to do it conditionally.
Let me be specific: I want to have a dropdown editor in one column if the related dataItem has a value of "true" in another of its fields, and no editor if the value is "false".
I think it should be something like this:
In this example the column with the editor uses the MyEditor function to create the editor. This works great without the conditional code, but fails with it. Essentially if the value of the dataItem field "RELATED" is true I want the editor, and otherwise I want no editor.
I've got a grid and I want to have a custom editor in one column under certain conditions, and have no editor under other conditions. Building the editor without the conditions is trivial, but I cannot figure out how to do it conditionally.
Let me be specific: I want to have a dropdown editor in one column if the related dataItem has a value of "true" in another of its fields, and no editor if the value is "false".
I think it should be something like this:
{
field:
"ID"
,
title:
"Title"
,
template:
"#=TITLE#"
,
editor:
function
() {
if
(
RELATED
) {
MyEditor
}
else
{
}
}
}