Datatables EDITOR-GENERATOR - Setting values for hidden attributes ("type": "hidden")
Datatables EDITOR-GENERATOR - Setting values for hidden attributes ("type": "hidden")
check_afterhours
Posts: 2Questions: 0Answers: 0
Hello,
I have a couple of Datatables created by Generator where a column is of type hidden.
I'd like to be able to set or update the value on that hidden field when User clicks on Create (Create New Entry) or Update (Edit Entry) buttons on the popup window -DIV-
I used the code example below; I'm sure my function 'getUserAndMasterID()' is setting and getting the right values, but nothing is being written on the database (for that specific column) via "setData.master_id"
What am I being wrong here?
Regards
var editor = new $.fn.dataTable.Editor( {
"ajaxUrl": "php/table.test.php",
"domTable": "#test",
"fields": [
{
"label": "Master ID",
"name": "master_id",
"type": "hidden"
},
{
"label": "User Name",
"name": "name",
"type": "text"
},
...
"events": {
"onSetData": function (json, setData, action) {
if ( action === "create" || action === "edit" ) {
userObj = getUserAndMasterID(setData.name);
alert(userObj.master_id);
setData.master_id = userObj.master_id;
}
}
}
I have a couple of Datatables created by Generator where a column is of type hidden.
I'd like to be able to set or update the value on that hidden field when User clicks on Create (Create New Entry) or Update (Edit Entry) buttons on the popup window -DIV-
I used the code example below; I'm sure my function 'getUserAndMasterID()' is setting and getting the right values, but nothing is being written on the database (for that specific column) via "setData.master_id"
What am I being wrong here?
Regards
var editor = new $.fn.dataTable.Editor( {
"ajaxUrl": "php/table.test.php",
"domTable": "#test",
"fields": [
{
"label": "Master ID",
"name": "master_id",
"type": "hidden"
},
{
"label": "User Name",
"name": "name",
"type": "text"
},
...
"events": {
"onSetData": function (json, setData, action) {
if ( action === "create" || action === "edit" ) {
userObj = getUserAndMasterID(setData.name);
alert(userObj.master_id);
setData.master_id = userObj.master_id;
}
}
}
This discussion has been closed.
Replies
Could you possibly confirm for me which DataTables users name you purchased Editor under. I see that the trial under your "check_afterhours" account expired about a month ago.
To assist with your query, I think I would probably need to see what your getUserAndMasterID() function looks like if you could paste in that code?
Many thanks,
Allan