Revision: 2168
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2168&view=rev
Author:   tbleher
Date:     2011-11-02 21:56:38 +0000 (Wed, 02 Nov 2011)
Log Message:
-----------
Add default tableOptions object for datatables, so it is easier to add
options to all datatables at once.

Modified Paths:
--------------
    mrbs/trunk/web/Themes/default/header.inc

Modified: mrbs/trunk/web/Themes/default/header.inc
===================================================================
--- mrbs/trunk/web/Themes/default/header.inc    2011-11-02 21:54:43 UTC (rev 
2167)
+++ mrbs/trunk/web/Themes/default/header.inc    2011-11-02 21:56:38 UTC (rev 
2168)
@@ -459,6 +459,16 @@
 
 //<![CDATA[
 
+var defaultTableOptions = new Object();
+<?php
+// Below you can set default values for all data tables; eg you can uncomment
+// the following two lines to display 50 entries by default and add an option
+// to view all entries at once (though be warned that displaying all entries
+// may be very slow)
+?>
+//defaultTableOptions.aLengthMenu = 
[[10,25,50,100,10000],[10,25,50,100,"All"]];
+//defaultTableOptions.iDisplayLength = 50;
+
 function getErrorList(errors)
 {
   var result = {html: '', text: ''};
@@ -1243,8 +1253,9 @@
       <?php
     }
     ?>
+    var tableOptions = jQuery.extend(true, {}, defaultTableOptions); // deep 
copy
     var roomsTable = makeDataTable('#rooms_table',
-                                   {},
+                                   tableOptions,
                                    {sWidth: "relative", iWidth: 33},
                                    rightCol);
     <?php
@@ -2565,7 +2576,7 @@
   {
     // Turn the list of users into a dataTable
     ?>
-    var tableOptions = new Object();
+    var tableOptions = jQuery.extend(true, {}, defaultTableOptions); // deep 
copy
     <?php // The Rights column has a span with title for sorting ?>
     tableOptions.aoColumnDefs = [{"sType": "title-numeric", "aTargets": [1]}]; 
     var usersTable = makeDataTable('#users_table',
@@ -2668,7 +2679,7 @@
                   });
                   
       <?php // Turn the table into a datatable ?>
-      var tableOptions = new Object();
+      var tableOptions = jQuery.extend(true, {}, defaultTableOptions); // deep 
copy
       tableOptions.sScrollXInner = "100%";
       tableOptions.aoColumnDefs = colDefsMain;
       <?php
@@ -2737,7 +2748,7 @@
     
     // Turn the list of users into a dataTable
     ?>
-    var tableOptions = new Object();
+    var tableOptions = jQuery.extend(true, {}, defaultTableOptions); // deep 
copy
     <?php
     // Use an Ajax source if we're able to - gives much better
     // performance for large tables
@@ -2938,7 +2949,7 @@
           }).appendTo(searchForm);
       }
       
-      var tableOptions = new Object();
+      var tableOptions = jQuery.extend(true, {}, defaultTableOptions); // deep 
copy
       <?php
       // Use an Ajax source - gives much better performance for large tables
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to