why is my datatables jeditable submitdata returning an empty value?
why is my datatables jeditable submitdata returning an empty value?
I have implemented datatables together with the jeditable plugin but when i edit a column and press enter the value that is passed in to the submitdata function is an empty string:
[code]
var readingListDataTable = $("#readingListDataTable").dataTable({
"aLengthMenu": [[10, 20, 50, 100], [10, 20, 50, 100]],
"iDisplayLength": 20,
'bJQueryUI': true,
'bLengthChange': true,
'oLanguage': {
'sSearch': 'Filter Media (press enter):'
},
'bProcessing': true,
'bServerSide': true,
'fnDrawCallback':function( oSettings ) {
$('td.editable').editable('../examples_support/editable_ajax.php', {
"callback": function (sValue, y) {
var aPos = readingListDataTable.fnGetPosition(this);
readingListDataTable.fnUpdate(sValue, aPos[0], aPos[1]);
debugger
},
"submitdata": function (value, settings) {
/************* value is empty here = ' ' *******************/
return {
"row_id": this.parentNode.getAttribute('id'),
"column": readingListDataTable.fnGetPosition(this)[2]
};
},
"height": "14px",
"placeholder": '',
"onblur":'submit'
});
},
'bDestroy': true,
'bAutoWidth': false,
"bPaginate": true,
"sPaginationType": "full_numbers",
'sAjaxSource': '/ReadingList/GetReadingLists',
"fnRowCallback": function (nRow, aData, iDisplayIndex) {
var id = aData['MediaID'];
$(nRow).attr("id",id);
return nRow;
},
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name":"iProjectID","value":projectID });
$.getJSON(sSource, aoData, function (json) {
fnCallback(json);
});
},
'bScrollCollapse': true,
"bStateSave": true,
"iCookieDuration": 60,
"aaSorting": [[0, 'asc']],
'aoColumns': [
{ sName: "MediaName", "sTitle": "Media Name", "mDataProp": "MediaName", "bVisible": true },
{ sName: "MediaTypeName", "sTitle": "Type", "mDataProp": "MediaTypeName", "bVisible": true },
{ sName: "Group1", "sTitle": "Group 1", "sClass": "editable", "mDataProp": "Group1", "sWidth": '7%', "bSearchable": false },
{ sName: "Group2", "sTitle": "Group 2", "sClass": "editable", "mDataProp": "Group2", "sWidth": '7%', "bSearchable": false },
{ sName: "Group3", "sTitle": "Group 3", "sClass": "editable", "mDataProp": "Group3", "sWidth": '7%', "bSearchable": false },
{ sName: "Group4", "sTitle": "Group 4", "sClass": "editable", "mDataProp": "Group4", "sWidth": '7%', "bSearchable": false },
{ sName: "Group5", "sTitle": "Group 5", "sClass": "editable", "mDataProp": "Group5", "sWidth": '7%', "bSearchable": false },
{ sName: "Group6", "sTitle": "Group 6", "sClass": "editable", "mDataProp": "Group6", "sWidth": '7%', "bSearchable": false },
{ sName: "Group7", "sTitle": "Group 7", "sClass": "editable", "mDataProp": "Group7", "sWidth": '7%', "bSearchable": false },
{ sName: "Group8", "sTitle": "Group 8", "sClass": "editable", "mDataProp": "Group8", "sWidth": '7%', "bSearchable": false },
{ sName: "Group9", "sTitle": "Group 9", "sClass": "editable", "mDataProp": "Group9", "sWidth": '7%', "bSearchable": false },
{ sName: "Group10", "sTitle": "Group 10", "sClass": "editable", "mDataProp": "Group10", "sWidth": '7%', "bSearchable": false },
{
"sTitle": "Action", "mDataProp": null, "bSearchable": false, "bSortable": false, "sWidth": '7%', "fnRender": function (obj, val) {
return "Edit"
+ " " + "Delete";
}
}
]
}).fnSetFilteringEnterPress({
minLength: 2
});
[/code]
[code]
var readingListDataTable = $("#readingListDataTable").dataTable({
"aLengthMenu": [[10, 20, 50, 100], [10, 20, 50, 100]],
"iDisplayLength": 20,
'bJQueryUI': true,
'bLengthChange': true,
'oLanguage': {
'sSearch': 'Filter Media (press enter):'
},
'bProcessing': true,
'bServerSide': true,
'fnDrawCallback':function( oSettings ) {
$('td.editable').editable('../examples_support/editable_ajax.php', {
"callback": function (sValue, y) {
var aPos = readingListDataTable.fnGetPosition(this);
readingListDataTable.fnUpdate(sValue, aPos[0], aPos[1]);
debugger
},
"submitdata": function (value, settings) {
/************* value is empty here = ' ' *******************/
return {
"row_id": this.parentNode.getAttribute('id'),
"column": readingListDataTable.fnGetPosition(this)[2]
};
},
"height": "14px",
"placeholder": '',
"onblur":'submit'
});
},
'bDestroy': true,
'bAutoWidth': false,
"bPaginate": true,
"sPaginationType": "full_numbers",
'sAjaxSource': '/ReadingList/GetReadingLists',
"fnRowCallback": function (nRow, aData, iDisplayIndex) {
var id = aData['MediaID'];
$(nRow).attr("id",id);
return nRow;
},
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name":"iProjectID","value":projectID });
$.getJSON(sSource, aoData, function (json) {
fnCallback(json);
});
},
'bScrollCollapse': true,
"bStateSave": true,
"iCookieDuration": 60,
"aaSorting": [[0, 'asc']],
'aoColumns': [
{ sName: "MediaName", "sTitle": "Media Name", "mDataProp": "MediaName", "bVisible": true },
{ sName: "MediaTypeName", "sTitle": "Type", "mDataProp": "MediaTypeName", "bVisible": true },
{ sName: "Group1", "sTitle": "Group 1", "sClass": "editable", "mDataProp": "Group1", "sWidth": '7%', "bSearchable": false },
{ sName: "Group2", "sTitle": "Group 2", "sClass": "editable", "mDataProp": "Group2", "sWidth": '7%', "bSearchable": false },
{ sName: "Group3", "sTitle": "Group 3", "sClass": "editable", "mDataProp": "Group3", "sWidth": '7%', "bSearchable": false },
{ sName: "Group4", "sTitle": "Group 4", "sClass": "editable", "mDataProp": "Group4", "sWidth": '7%', "bSearchable": false },
{ sName: "Group5", "sTitle": "Group 5", "sClass": "editable", "mDataProp": "Group5", "sWidth": '7%', "bSearchable": false },
{ sName: "Group6", "sTitle": "Group 6", "sClass": "editable", "mDataProp": "Group6", "sWidth": '7%', "bSearchable": false },
{ sName: "Group7", "sTitle": "Group 7", "sClass": "editable", "mDataProp": "Group7", "sWidth": '7%', "bSearchable": false },
{ sName: "Group8", "sTitle": "Group 8", "sClass": "editable", "mDataProp": "Group8", "sWidth": '7%', "bSearchable": false },
{ sName: "Group9", "sTitle": "Group 9", "sClass": "editable", "mDataProp": "Group9", "sWidth": '7%', "bSearchable": false },
{ sName: "Group10", "sTitle": "Group 10", "sClass": "editable", "mDataProp": "Group10", "sWidth": '7%', "bSearchable": false },
{
"sTitle": "Action", "mDataProp": null, "bSearchable": false, "bSortable": false, "sWidth": '7%', "fnRender": function (obj, val) {
return "Edit"
+ " " + "Delete";
}
}
]
}).fnSetFilteringEnterPress({
minLength: 2
});
[/code]
This discussion has been closed.