how to update of a form field within a datatable cell

how to update of a form field within a datatable cell

longestdrivelongestdrive Posts: 9Questions: 5Answers: 0

I've got a Datatable set up which contains a form field on each row.

What I want to do is update the value of this field for each row.

I'm iterating over each row of the table with this function:

castTable.rows().every(function ( rowIdx, tableLoop, rowLoop ){
                var data = this.data();
                var page_order = data[1];

                console.log("row data:", data[1]);

            });

page_order then contains the string that represents the field as follows:

<input class="form-control page_order" name="page_order[0]" type="text" value="1">

I've tried using this to create a jquery object and update the value that way but can't then work out how to place this back in the data object as a string.

What is the correct way to set the value of a form field in the data object within each row?

If I access via the data method it's just a string. If I was doing this to a normal form field outside of datatables I would do

$('#form_field).val("new value")

But I can't work out how to do this within this method and want to avoid replacing the html string

This discussion has been closed.