Bind the columns from server and pass some data to server in request
Bind the columns from server and pass some data to server in request
Hi
I am trying to use this plugin in serverside process. So far I m able to bind the serverdata as ajax source and works fine with table data.
But I would like to bind the columns also dynamically and pass aoData to server with request and not sure how.
I have seen some post and implemented as below.
@import "Styles/demo_page.css";
@import "Styles/demo_table.css";
$(document).ready(function( v) {
$.ajax({
"dataType": 'text',
"type": "GET",
"url": "test.txt",
"success": function(dataStr) {
var data = dataStr.replace("", "");
data = data.replace("", "");
data = JSON.parse(data);
$('#tblReport').dataTable({
"aaData": data.aaData,
"aoColumns": data.aoColumns
});
}
});
});
This code displays the table correctly. But how can get and pass the aoData[] through the request since the datatable initialized after the get request.
Do I need to make request twice not sure. Please share any sample code.
thanks in advance.
I am trying to use this plugin in serverside process. So far I m able to bind the serverdata as ajax source and works fine with table data.
But I would like to bind the columns also dynamically and pass aoData to server with request and not sure how.
I have seen some post and implemented as below.
@import "Styles/demo_page.css";
@import "Styles/demo_table.css";
$(document).ready(function( v) {
$.ajax({
"dataType": 'text',
"type": "GET",
"url": "test.txt",
"success": function(dataStr) {
var data = dataStr.replace("", "");
data = data.replace("", "");
data = JSON.parse(data);
$('#tblReport').dataTable({
"aaData": data.aaData,
"aoColumns": data.aoColumns
});
}
});
});
This code displays the table correctly. But how can get and pass the aoData[] through the request since the datatable initialized after the get request.
Do I need to make request twice not sure. Please share any sample code.
thanks in advance.
This discussion has been closed.