Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82800

How do I build a function that creates my table, then returns it?

$
0
0
Folks,

This is probably a more general jQuery question, something I am still learning. But I want to abstract my datatable creation a bit. So I created a separate js function, to which I pass my data, css name, etc. It creates the table, then I want to pass back that table. Reason for that, is so that I can perform work against it later (like filter calls, etc). However I just cannot with JS get it done, any experts?

So far its something like

function createTable(data, columns, css)
{
  var oTable;
  $function()
   {
       var tablecss = $(css);
          oTable = tableCss.dataTable(
	    {
	    	// datatable stuff
	    });	
   }
   return oTable;
}

However oTable is always undefined. Is there a way to perform a callback?

Viewing all articles
Browse latest Browse all 82800

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>