Editor - Problem with inline boolean selects and null values
Editor - Problem with inline boolean selects and null values
Hello!
I'm running into a problem when trying to use an inline Editor select on a boolean column. The select has two options with true and false boolean values:
var fields = [
{label: 'ID', name: 'id', type: 'text'},
{label: 'Cool', name: 'cool', type: 'select', options: [{label: "Yes", value: true}, {label: "No", value: false}]}
];
The issue is with editing rows that have null as the initial value in the cell (e.g. row 3 in the linked example below)—if you try to edit such a cell and select the false option, no submit event is emitted. Editor seems to consider null to be equivalent to false, and thus does not think that the field has changed in value. I've also tried playing around with the placeholder and placeholderValue options to no avail. Let me know if there's something I'm missing!
Link to test case: http://live.datatables.net/dewojuxo/1/edit
This question has an accepted answers - jump to answer
Answers
One fix for that would be to edit the
form-optionsto always submit the data for that column, something like this.Would that work?
Colin
Setting
submit: 'all'caused some issues with empty values in other fields getting submitted, but I was able to fix that by settingscope: 'cell'. I do think there's still an underlying bug somewhere that could be worth addressing, but this is definitely a useable workaround, thanks Colin!