Unable to Get Data from MVC Controller
Unable to Get Data from MVC Controller
Hello I am trying to get data from an MVC Controller using .ajax. I am using 3rd party web design template and the DataTable is initalized in the .js file provided with the template. I can't modify the code in the template. But the Datatable get initialized using "Class" therefore if i try to initialze it using javascript i get an error. Therefore I get the current instance of the Data table and bind the datasource. but i can't figure out how to rebind the datasource.
my code is.
[code]
function initTable() {
return $('#example1').dataTable({
"bJQueryUI": true,
"bRetrieve": true,
});
}
function populateGrid() {
var table = initTable();
table.bJQueryUI = true;
table.bServerSide = true;
table.bProcessing = true;
table.sAjaxSource= '@Url.Action( "MemberList","User" )',
// table.bDeferRender = true;
table.aoColumns = [
{
"sName": "FirstName",
"bSearchable": false,
"bSortable": false
},
{
"sName": "LastName",
"bSearchable": false,
"bSortable": false
},
{
"sName": "Email",
"bSearchable": false,
"bSortable": false
},
{
"sName": "Active",
"bSearchable": false,
"bSortable": false
},
{
"sName": "Delete",
"bSearchable": false,
"bSortable": false
}
];
table.fnDraw();
}
[/code]
my code is.
[code]
function initTable() {
return $('#example1').dataTable({
"bJQueryUI": true,
"bRetrieve": true,
});
}
function populateGrid() {
var table = initTable();
table.bJQueryUI = true;
table.bServerSide = true;
table.bProcessing = true;
table.sAjaxSource= '@Url.Action( "MemberList","User" )',
// table.bDeferRender = true;
table.aoColumns = [
{
"sName": "FirstName",
"bSearchable": false,
"bSortable": false
},
{
"sName": "LastName",
"bSearchable": false,
"bSortable": false
},
{
"sName": "Email",
"bSearchable": false,
"bSortable": false
},
{
"sName": "Active",
"bSearchable": false,
"bSortable": false
},
{
"sName": "Delete",
"bSearchable": false,
"bSortable": false
}
];
table.fnDraw();
}
[/code]
This discussion has been closed.
Replies
Allan