inline edit of a field is also submitting all the select fields (with null values)

inline edit of a field is also submitting all the select fields (with null values)

nomanmariyamnomanmariyam Posts: 4Questions: 2Answers: 1

inline edit submit of any field is also submitting all the select fields with first available options

editor = new $.fn.dataTable.Editor( {
table: "#table",
fields: [
{
label: "Style No",
name: "styleNo",
type: "text"
},
{
label: "Ax Colour",
name: "axColour",
type: "select",
options: [
{ label: "One Color", value: "00" },
{ label: "White", value: "01" },
]
},
ajax: function (method, url, d, successCallback, errorCallback) {
console.log(d.data);
if ( d.action === 'edit' ) {
/code to update
}
},
});

$.fn.dataTableInstance[0] = $("#table").DataTable( {ajax: {
url: "${purchaseOrderServiceUrl}orderLineItems?orderId=${orderId}",
type: "GET",
},
columns: [
{ data: "styleNo"},
{ data: "axColour"},
]
});

when i change the styleNo, axColour field is also submitted if the value of the field was null .

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    That suggests that the other fields (the select fields) don't have a value in their list of options that matches the value for the row. The select will take the first value in the select list if it doesn't have the value given to it (the same way that an HTML select works.

    Allan

  • nomanmariyamnomanmariyam Posts: 4Questions: 2Answers: 1

    thanks allan, the Initial value of the field is null, and i tried to add one more option with null values
    { label: null, value: null },
    but still same behaviour

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Can you link to the page showing the issue so I can take a look please?

    Thanks,
    Allan

  • nomanmariyamnomanmariyam Posts: 4Questions: 2Answers: 1
    Answer ✓

    thanks Allan, unfortunately i do not have public domain to share , but i did a work around and gave always default value to field

This discussion has been closed.