Editor using field type checkbox not rendering 'isChecked' on the inline editor input
Editor using field type checkbox not rendering 'isChecked' on the inline editor input
I have an editor setup with a field as a checkbox for a boolean value in my database using something like this:
fields: [
{
label: "Completed",
name: "isComplete",
type: "checkbox",
separator: "",
options: [
{ label: "", value: 1 }
],
unselectedValue: 0
}
]
I am using the inline editing feature on the editor as well. The problem I am having is when the value is "true" (1 in this case) the checkbox isn't selected/checked. Everything is saved correctly when updating and the data table is rendered correctly. The problem I am having is the inline editor input checkbox is never 'checked' (property isChecked) despite the value saved in the database. Is there a way to set how the input renders or am I missing something?
This question has an accepted answers - jump to answer
Answers
Are you disabling inline editing on the column that contains the checkbox?
This is snippets from one of my pages using checkbox:
Editor Field:
DT RowCallback:
Code to update checkbox:
The checkbox is in column 6 (:nth-child(6)) - don't inline edit
HTH,
Kevin
Thanks Kevin!! I don't have inline editing disabled on that column. I think I'll do the same as you - it looks more elegant than using the inline editor as I am now. I ended up finding my problem. Changing:
to:
fixed the issue of the checkbox ignoring the current value of the field and not being checked inside of the inline editor (isChecked property). I guess this is because its a boolean and its coming back as "True" rather than 1 as I had expected.