Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to find that a table in page is a dataTable object?

I am looking for a way to get to know if the tables in a page are dataTable or not? Is there an easy way to find it? Or may be if I can get all the objects of dataTable.

like image 398
emphaticsunshine Avatar asked Jan 19 '12 22:01

emphaticsunshine


People also ask

How do you check if a table is DataTable?

function isDataTable( table ) Description: Check if a table node is a DataTable table already or not.

How do I find DataTables?

Searching on individual columns can be performed using the columns().search() and column().search() methods. DataTables has a built in search algorithm referred to as "smart" searching and is designed to make searching the table data, easy to use for the end user.

How do I know if a DataTable is loaded?

You can use the fnDrawCallback function. It gets called every time the table is drawn. This would include when the table is loaded with data, sorted or filtered. This worked for me.

What is FN in DataTable?

function tables( [ visible ] )As a boolean value this options is used to indicate if you want all tables on the page should be returned ( false ), or visible tables only ( true ).


1 Answers

There's a static method in the DataTables plugin, so you may verify as:

$('table').each(function() {
    // this method accepts the DOM node (table element) as parameter
    if ( $.fn.dataTable.fnIsDataTable(this) ) {
         // do your thing to the table
    }
});
like image 98
Roy Ling Avatar answered Oct 27 '22 01:10

Roy Ling