nhn / tui.grid

🍞🔡 The Powerful Component to Display and Edit Data. Experience the Ultimate Data Transformer!
http://ui.toast.com/tui-grid/
MIT License
2.39k stars 385 forks source link

Sending JSON data to server #2011

Closed bacloud23 closed 2 months ago

bacloud23 commented 6 months ago

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