Datatables need your help....
Datatables need your help....
PrabaOnNet
Posts: 6Questions: 0Answers: 0
I am using DataTables in a DNN site. My page uses pagination and allows user to check a checkbox and enter data (13 textboxes per row). At the end user clicks on Submit, then the code should submit all rows (including the hidden rows).
Following approach doesnt work because I have a file upload textbox ( )
var sData = oTable.$('input').serialize();
So I have tried another manual solution,
function PrepareForSubmit() {
$("#divTranData").show();
var oSettings = oTable.fnSettings();
oSettings._iDisplayLength = 500;
oTable.fnDraw(true);
return true;
}
Above solution works perfectly fine in my local machine. If I deploy this in Test machine then it throws "Object moved here error". The error is caused due to oTable.fnDraw method. If I comment the oTable.fnDraw then it doesn't throw any error but it doesn't submit elements from hidden pages.
Any help is greatly appreciated as I am banging my head right now!!!!!!!!
Following approach doesnt work because I have a file upload textbox ( )
var sData = oTable.$('input').serialize();
So I have tried another manual solution,
function PrepareForSubmit() {
$("#divTranData").show();
var oSettings = oTable.fnSettings();
oSettings._iDisplayLength = 500;
oTable.fnDraw(true);
return true;
}
Above solution works perfectly fine in my local machine. If I deploy this in Test machine then it throws "Object moved here error". The error is caused due to oTable.fnDraw method. If I comment the oTable.fnDraw then it doesn't throw any error but it doesn't submit elements from hidden pages.
Any help is greatly appreciated as I am banging my head right now!!!!!!!!
This discussion has been closed.
Replies
Allan
[code]
//Serializes Form for JSON
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
[/code]
and just call it with
[code] var payload = $('#id').serializeObject();[/code]
Allan
Here is what I did to work-around the issue:
1. On submit, loop thru all nodes and delete empty rows.
2. Set page size to some max (500) and call fnDraw
3. Added a delay routine for 3 seconds
4. Submit the form now.
It works properly without any error.