I have a function like this to populate my columns on my datatable:
As you can Imagine my attributes are in an array so my structure is something like this:
{"id": "-1","attributes": [{"value": "Luis"},{"value": "Torrico"}]}
I have a similar function for the fields to be used on the editor (currently evaluating for purchase):
Everything works fine but when using the editor and creating a new row the data gets structured like this:
{"id": "-1","attributes":{ "0":{ "value":"Luis" },"1":{ "value":"Torrico"} } }
So it is not actually an array of attributes but an object.
I already tried using "attributes[" + index + "].value" as de mData/name prop but it doesn't seems to be working.
Any way to have the editor data to be structured like an array to avoid having to proccess the data before sending it to the backend that expects an array?
getColumns: function(){ var columns = []; _.each(this.model.attributes.attributes, function(item, index) { columns.push({ sTitle: item.name, mData: "attributes." + index + ".value" }); }); return columns; }
As you can Imagine my attributes are in an array so my structure is something like this:
{"id": "-1","attributes": [{"value": "Luis"},{"value": "Torrico"}]}
I have a similar function for the fields to be used on the editor (currently evaluating for purchase):
getFields: function(){ var fields = []; _.each(this.model.attributes.attributes, function(item, index) { fields.push({ label: item.name, name: "attributes." + index + ".value" }); }); return fields; }
Everything works fine but when using the editor and creating a new row the data gets structured like this:
{"id": "-1","attributes":{ "0":{ "value":"Luis" },"1":{ "value":"Torrico"} } }
So it is not actually an array of attributes but an object.
I already tried using "attributes[" + index + "].value" as de mData/name prop but it doesn't seems to be working.
Any way to have the editor data to be structured like an array to avoid having to proccess the data before sending it to the backend that expects an array?