ASP MVC DataTables - No Errors No rows displayed
ASP MVC DataTables - No Errors No rows displayed
rikkotec
Posts: 1Questions: 0Answers: 0
Hi Allan, or anyone who may be able to give advice -
I'm working to implement DataTables in an ASP MVC project I'm working on.
I seem to have everything set up properly, but I'm not seeing any data getting loaded into the table. I'm using AJAX Source, the debug data link is: http://debug.datatables.net/ewupij
Here's some of the code for reference:
Table:
[code]
Record Id
@Html.DisplayNameFor( model => model.CampaignName )
@Html.DisplayNameFor( model => model.StartDate )
@Html.DisplayNameFor( model => model.StopDate )
@Html.DisplayNameFor( model => model.CampaignType )
@Html.DisplayNameFor( model => model.CampaignValue )
@Html.DisplayNameFor( model => model.Manufacturer )
@Html.DisplayNameFor( model => model.GroupId )
@Html.DisplayNameFor( model => model.ProductLineId )
Record Id
@Html.DisplayNameFor( model => model.CampaignName )
@Html.DisplayNameFor( model => model.StartDate )
@Html.DisplayNameFor( model => model.StopDate )
@Html.DisplayNameFor( model => model.CampaignType )
@Html.DisplayNameFor( model => model.CampaignValue )
@Html.DisplayNameFor( model => model.Manufacturer )
@Html.DisplayNameFor( model => model.GroupId )
@Html.DisplayNameFor( model => model.ProductLineId )
[/code]
Here is the JS:
[code]
$( '#' + options['viewport'] ).dataTable // options[viewport] is the id of the table displayed above.
(
{
"bJQueryUI": true,
"bProcessing": true,
//"bServerSide": true,
"sAjaxSource": url,
"sPaginationType": "full_numbers",
"iDisplayLength": "25",
"sDefaultContent": " "
}
);
[/code]
The Json that is returned from the server is in the debugger link at the top of this post
I originally had errors, but worked through all of them. I've tried using bServerSide, tried having each row of data in the json be an array rather than an object, tried declaring aoColumns and specifying mDataProp: 0, mDataProp: 1, etc, tried putting empty rows inside of tbody.....all with no luck.
I have absolutely no errors, no warnings, and no data being displayed, but as the debugger data shows proper json is returning. I should note that I am using jQuery 1.11, I'm about to try jQuery 1.10.2 but it'd be cool if we could have it working in jQuery 1.11 too! I've tested in IE, Chrome, and FF with the same results.
Thanks in advance!
EDIT**
Tested in jQuery 1.10.2 and same problem - No errors, warning, or data within the Table.
I'm working to implement DataTables in an ASP MVC project I'm working on.
I seem to have everything set up properly, but I'm not seeing any data getting loaded into the table. I'm using AJAX Source, the debug data link is: http://debug.datatables.net/ewupij
Here's some of the code for reference:
Table:
[code]
Record Id
@Html.DisplayNameFor( model => model.CampaignName )
@Html.DisplayNameFor( model => model.StartDate )
@Html.DisplayNameFor( model => model.StopDate )
@Html.DisplayNameFor( model => model.CampaignType )
@Html.DisplayNameFor( model => model.CampaignValue )
@Html.DisplayNameFor( model => model.Manufacturer )
@Html.DisplayNameFor( model => model.GroupId )
@Html.DisplayNameFor( model => model.ProductLineId )
Record Id
@Html.DisplayNameFor( model => model.CampaignName )
@Html.DisplayNameFor( model => model.StartDate )
@Html.DisplayNameFor( model => model.StopDate )
@Html.DisplayNameFor( model => model.CampaignType )
@Html.DisplayNameFor( model => model.CampaignValue )
@Html.DisplayNameFor( model => model.Manufacturer )
@Html.DisplayNameFor( model => model.GroupId )
@Html.DisplayNameFor( model => model.ProductLineId )
[/code]
Here is the JS:
[code]
$( '#' + options['viewport'] ).dataTable // options[viewport] is the id of the table displayed above.
(
{
"bJQueryUI": true,
"bProcessing": true,
//"bServerSide": true,
"sAjaxSource": url,
"sPaginationType": "full_numbers",
"iDisplayLength": "25",
"sDefaultContent": " "
}
);
[/code]
The Json that is returned from the server is in the debugger link at the top of this post
I originally had errors, but worked through all of them. I've tried using bServerSide, tried having each row of data in the json be an array rather than an object, tried declaring aoColumns and specifying mDataProp: 0, mDataProp: 1, etc, tried putting empty rows inside of tbody.....all with no luck.
I have absolutely no errors, no warnings, and no data being displayed, but as the debugger data shows proper json is returning. I should note that I am using jQuery 1.11, I'm about to try jQuery 1.10.2 but it'd be cool if we could have it working in jQuery 1.11 too! I've tested in IE, Chrome, and FF with the same results.
Thanks in advance!
EDIT**
Tested in jQuery 1.10.2 and same problem - No errors, warning, or data within the Table.
This discussion has been closed.