Grid Control as dataTable
Grid Control as dataTable
Hi,
I am new to dataTable, I want to know whether we can take grid control id as dataTable.
I've this grid control defined in aspx page :-
[code]
[/code]
and in js file, I am initializing the grid control as :-
[code]
$(document).ready(function() {
try {
var gridControl = $('#gridControl').dataTable();
}
});
[/code]
While initializing Iam not getting any error, when I am trying to call fnGetNodes() method as:
[code]
var Rows = $('#gridControl').dataTable().fnGetNodes();
var grid = new Array();
$(Rows).each(function() {
var nextRow = new Array();
grid.push(nextRow);
$("td", this).each(function() {
var nextValue = $("input", this).val();
nextRow.push(nextValue);
});
});
[/code]
I am getting an exception which says :- "aoData is null or not an object."
Please let me know can we call grid as Datatable? If not what can be the alternative, do I need to fill grid data into something else(?) and then pass it to dataTable.
I am new to dataTable, I want to know whether we can take grid control id as dataTable.
I've this grid control defined in aspx page :-
[code]
[/code]
and in js file, I am initializing the grid control as :-
[code]
$(document).ready(function() {
try {
var gridControl = $('#gridControl').dataTable();
}
});
[/code]
While initializing Iam not getting any error, when I am trying to call fnGetNodes() method as:
[code]
var Rows = $('#gridControl').dataTable().fnGetNodes();
var grid = new Array();
$(Rows).each(function() {
var nextRow = new Array();
grid.push(nextRow);
$("td", this).each(function() {
var nextValue = $("input", this).val();
nextRow.push(nextValue);
});
});
[/code]
I am getting an exception which says :- "aoData is null or not an object."
Please let me know can we call grid as Datatable? If not what can be the alternative, do I need to fill grid data into something else(?) and then pass it to dataTable.
This discussion has been closed.
Replies
Is the grid an HTML table with THEAD and TBODY sections? DataTables will only work on semantic HTML markup for tabular data (i.e. a table) as noted in the prerequisites: http://datatables.net/usage/
Allan