user649802
user649802

Reputation: 3253

How to use Datatable in javascript

 $('#dFinalReport').html(_todayOrderLstHtml);
 $('#dFinalReport').dataTable(
  { "sDom": 'l<"floatR pLeft10"T><"floatR"f>rtip',
    "aaSorting": [[3, "asc"]], "iDisplayLength": 20
  });

How to use datatable in javascript?

i declared div element in html and called datatable using div id(dFinalReport).i got a error message --------->

DataTables warning (table id = 'dFinalReport'): Attempted to initialise DataTables on a node which is not a table: DIV

which id i should use to call datatable and when i call?

Upvotes: 0

Views: 2932

Answers (2)

Dropout
Dropout

Reputation: 13866

I had a similar problem and changing the wrapper fixed it for me. I don't know C# but check if you don't have something similar to this. I had the following in my code:

<div id='data_table_wrapper'>
{{=user_table}}
</div>

The "{{=user_table}}" basically calls the table - I am using python instead of C#. DataTable has a specific structure, the ID cannot be assigned to a DIV. Changing it to the following fixed my problem:

<table id='data_table_wrapper'>
{{=user_table}}
</table>

Edit: Also check the manual on http://www.datatables.net for further instructions - you have to be using a structure that includes thead, and so on..

Upvotes: 0

Amitabh
Amitabh

Reputation: 61177

If you are using jquery.datatable plugin then please refer to.

http://www.datatables.net/

Upvotes: 1

Related Questions