Create/update DB table column from two fields
Create/update DB table column from two fields
peterbrowne
Posts: 314Questions: 54Answers: 0
in Editor
I want to set table a column week.week_full_name
value based on the values of two fields, week.week
and unit_group.unit_group
.
var editor = new $.fn.dataTable.Editor( {
ajax: "program_data/week_data.php",
table: "#week_table",
template: '#week_form',
fields: [ {
label: "Week:",
name: "week.week"
}, {
label: "Week Full Name:",
name: "week.week_full_name"
}, {
label: "Unit Group:",
name: "week.unit_group_fk",
type: "select",
placeholder: "Select Unit Group..."
} ]
});
var table = $( '#week_table' ).DataTable( {
responsive: true,
columnDefs: [ {
targets: [1],
render: $.fn.dataTable.render.ellipsis( 100, true )
} ],
ajax: "program_data/week_data.php",
dom: "Bfrtip",
columns: [ {
data: "week.week"
}, {
data: "week.week_full_name"
}, {
data: "unit_group.unit_group"
}, {
data: "week.modified"
}, {
data: "week.modified_by"
} ],
select: {
style: 'os',
selector: 'td:first-child'
},
buttons: []
} );
Answers
Server side I have tried the following but not working...
The data is submitted as 2D arrays, so
should be:
Respectively,
Allan