You can have more than one instance of TableGear within a single page.
$tg1 = new TableGear(array( "database" => array( "username" => "USERNAME", "password" => "PASSWORD", "database" => "DATABASE", "table" => "TABLE1" ), "sortable" => "all", "editable" => "all" )); $tg2 = new TableGear(array( "database" => array( "username" => "USERNAME", "password" => "PASSWORD", "database" => "DATABASE", "table" => "TABLE2" ), "sortable" => "all", "editable" => "all" )); $tg1->getTable(); $tg2->getTable(); $tg1->getJavascript(); $tg2->getJavascript();
Having multiple tables in your page works pretty much as you might expect. Simply use a second constructor with the information of the other table you're using, and assign it to a different variable. Then for each variable you can call both the getTable and getJavascript methods. All other methods work exactly the same. TableGear will automatically assign unique IDs to the tables and pass them through the json to tell them apart.
If you want to control the unique IDs of your table manually, you can pass them into the constructor, otherwise TableGear will automatically increment them every time the constructor is called