tui.grid
tui.grid copied to clipboard
Sending JSON data to server
Having the following instance:
const grid = new Grid({
el: document.getElementById('grid'),
data: {
api: {
readData: { url: '/admin/', method: 'GET' },
updateData: { url: '/admin/', method: 'PUT' },
},
contentType: 'application/json;charset=UTF-8',
},
rowHeaders: ['rowNum'],
columns: [
{
header: 'Deactivated',
name: 'd',
editor: {
type: 'radio',
options: {
listItems: [
{ text: 'Activated', value: false },
{ text: 'Deactivated', value: true },
],
},
},
sortable: true,
}, // ... other columns
],
})
With contentType: 'application/json;charset=UTF-8', and data itself indeed being of boolean type ( Deactivated column)
The data that is being sent is a string ("false" or "true")
{
"_id": "65a0352e0000000000000000",
"title": "composante dissecteur oxygénase ",
"a": "true", // altered radio value
"d": false, // correct original value
"rowKey": 0,
"_attributes": {
"rowNum": 1,
"checked": false,
"disabled": false,
"checkDisabled": false,
"className": {
"row": [],
"column": {}
}
}
}
Is there a possible solution to this ?
Thanks a lot