Server Side not passing aoData MVC
Server Side not passing aoData MVC
Godrules500
Posts: 25Questions: 13Answers: 0
I have a Data table that looks like below. I'm trying to pass the aoData to my controller, BUT my controller is not able to get it. I've tried using Request, and I have a JQueryDataTableParamModel class that gets nothing. Now my aoData has like 242 columns. So did I maybe set it up incorrectly? Shouldn't aoData just have a few objects like sEcho and a few more?
var table = $('#example').DataTable({
"ajax": {
"url": "@Url.Action("AddEditMoneyBreakdown", "ReceiptSetupFile")",
"type": "POST"
},
"bProcessing": true,
"bAutoWidth": true,
"bServerSide": true,
"sScrollY": "auto",
"pagingType": "full_numbers",
"sScrollX": "auto",
"sAjaxSource": {
"url": "@Url.Action("AddEditMoneyBreakdown", "ReceiptSetupFile")",
"type": "POST"
},
"fnServerParams": function ( aoData ) {
},
"fnServerData": function (sSource, aoData, fnCallback)
{
//var oModel = new Object()
//oModel.sEcho =
debugger;
$.ajax({
"type": "POST",
"url": sSource.url,
//"data": JSON.stringify({ "param": { "sEcho": aoData } }),
"data": JSON.stringify(aoData),
"success": fnCallback
});
},
"columnDefs": [
{
render: function (data, type, row, a)
{
sColName = a.settings.aoColumns[a.col].sTitle
var sCurrency = "";
return BuildInput(row.ID, data, sColName)
},
className: "dt-body-center",
"orderDataType": "dom-text",
"targets": [1, 2, 3, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40]
},
{
render: function (data, type, row, a)
{
sColName = a.settings.aoColumns[a.col].sTitle
var sCurrency = "";
sCurrency = CheckEmptyCurrency(data)
data = sCurrency
return BuildLessAmtInput(row.ID, sCurrency, sColName)
},
className: "dt-body-center",
"orderDataType": "dom-text",
"type": "num-fmt",
"targets": [5, 6, 8, 9, 11, 12, 14, 15, 17, 18, 20, 21, 23, 24, 26, 27, 29, 30, 32, 33, 35, 36, 38, 39]
}
],
"columns": [
{ "data": "ID" },
{ "data": "EntityNo" },
{
"data": "RecType",
},
{ "data": "FundType" },
{
"data": "RecDesc",
"sWidth": "300px"
},
{ "data": "LessAmt1" },
{ "data": "LessPct1" },
{ "data": "LessSum1" },
{ "data": "LessAmt2" },
{ "data": "LessPct2" },
{ "data": "LessSum2" },
{ "data": "LessAmt3" },
{ "data": "LessPct3" },
{ "data": "LessSum3" },
{ "data": "LessAmt4" },
{ "data": "LessPct4" },
{ "data": "LessSum4" },
{ "data": "LessAmt5" },
{ "data": "LessPct5" },
{ "data": "LessSum5" },
{ "data": "LessAmt6" },
{ "data": "LessPct6" },
{ "data": "LessSum6" },
{ "data": "LessAmt1Next" },
{ "data": "LessPct1Next" },
{ "data": "LessSum1Next" },
{ "data": "LessAmt2Next" },
{ "data": "LessPct2Next" },
{ "data": "LessSum2Next" },
{ "data": "LessAmt3Next" },
{ "data": "LessPct3Next" },
{ "data": "LessSum3Next" },
{ "data": "LessAmt4Next" },
{ "data": "LessPct4Next" },
{ "data": "LessSum4Next" },
{ "data": "LessAmt5Next" },
{ "data": "LessPct5Next" },
{ "data": "LessSum5Next" },
{ "data": "LessAmt6Next" },
{ "data": "LessPct6Next" },
{ "data": "LessSum6Next" }
],
"fnCreatedRow": function (nRow, aData, iDataIndex)
{
$(nRow).prop("id", "dataRow" + iDataIndex);
}
});
function BuildInput(sID, sData, sCol)
{
return "<input type='text' name='row-" + sID + "-" + sCol + "' id='row-" + sID + "-" + sCol + "' value='" + sData + "' class='form-control'></input>";
}
function BuildLessAmtInput(sID, sData, sCol)
{
return "<input type='text' name='row-" + sID + "-" + sCol + "' id='row-" + sID + "-" + sCol + "' value='" + sData + "' onBlur='GetFormatOnBlur(this)' class='form-control'></input>";
}
This discussion has been closed.