Tuesday, 15 September 2015

jQuery dataTable fail -


I am using the dataTable plugin I fix this problem:

The table.row function is not

(instead of D use ataTable () D ataTable ())

This works:

  function initTable (selector, ext) {// merge defaults and extended settings ... // init plugin var table = $ (selector). DataTable ( Parameter); } // call initTable ('# blah-blah', {...});  

But I want to use the cash variable (one time) and for others.

This is not working (table.row function is not again):

  function initTable (jqObj, ext) {// merge defaults and extended settings. .. // init plugin jqObj.DataTable (parameter); } // call var table = $ ('# blah-blah'); InitTable (table, {...}); // Reuse the table again  

Return table object from initTable? seriously? Do you know in another way?

In the first function, you are passing some selectors to create a new JQuery object and in another function You are passing a jQuery object. So, I believe the problem is in the second line of your code because your second method works perfectly well in this code sample:

  $ (document) .ready (function () {Function initTable (jqObj), Ext) {jqObj.dataTable (ext);} // call var table = $ ('# example'); InitTable (table, {"sPaginationType": "full_numbers"})}};  

Demo:


No comments:

Post a Comment