Unable to Get Data from MVC Controller

Unable to Get Data from MVC Controller

umairumair Posts: 1Questions: 0Answers: 0
edited November 2013 in General
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]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'm a bit confused I'm afraid - are you saying that all tables of a given class are being initialised by the template? If that's the case, you'll probably need to destroy the table that the template has completed using fnDestroy and then create a new one if you want to change the initialisation options.

    Allan
This discussion has been closed.