I am creating a simple admin user interface using Ext JS 4. I started with this example from the Sencha website. I added a group of labels to the form (with four options), and I have fields that are dynamically checked based on the selected record in the grid below the form. Everything works correctly, but when I send data to the server, the format of the data from the group of flags depends on which button is clicked.
For example, when I edit a record and press the save button, Ext JS sends an array with true / false values corresponding to the checkboxes set:
{"available": [true, true, false, false]}
When I create a completely new record and click the add button, Ext JS sends an array with the names of the checked flags:
{"available": ["Selection_1", "Selection_2", "Selection_3"]}
Finally, if I create a new record and click the "Add" button, but only checks ONE, Ext JS sends one string value (unlike the array that it sent in the second example):
{available": "Selection_1"}
Why does Ext JS do this? This makes it difficult to work with data on the server side. Also, is there a way I can override the way data is sent to the server so that it sends it in the same format as the add button? Thanks!
source share