Revision: 2034
http://mrbs.svn.sourceforge.net/mrbs/?rev=2034&view=rev
Author: cimorrison
Date: 2011-09-30 09:54:25 +0000 (Fri, 30 Sep 2011)
Log Message:
-----------
Improved behaviour of datatables on window resize. Still some glitches.
Modified Paths:
--------------
mrbs/branches/datatables/web/Themes/default/header.inc
mrbs/branches/datatables/web/jquery/datatables/css/mrbs-table.css
Modified: mrbs/branches/datatables/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/datatables/web/Themes/default/header.inc 2011-09-29
22:55:57 UTC (rev 2033)
+++ mrbs/branches/datatables/web/Themes/default/header.inc 2011-09-30
09:54:25 UTC (rev 2034)
@@ -264,6 +264,12 @@
var oFC = new FixedColumns(oTable, {"iLeftColumns": 1,
"iLeftWidth": leftWidth,
"sLeftWidth": "fixed"});
+ <?php
+ // Not quite sure why we have to adjust the column sizing
here,
+ // but if we don't then the table isn't quite the right
width
+ // when first drawn
+ ?>
+ oTable.fnAdjustColumnSizing();
$('.js div.datatable_container').css('visibility',
'visible');
};
<?php
@@ -282,9 +288,24 @@
?>
var mergedOptions = $.extend(true, {}, defaultOptions,
specificOptions);
var oTable = table.dataTable(mergedOptions);
- <?php // Need to redraw the datatable when the browser window is
resized ?>
+ <?php
+ // Need to re-create the datatable when the browser window is
resized. We
+ // can't just do a fnDraw() because that does not redraw the Fixed
Columns
+ // properly
+ ?>
$(window).bind('resize', function () {
- oTable.fnDraw();
+ <?php
+ // If we're using an Ajax data source then we don't want to
have to make
+ // an Ajax call and wait for the data every time we resize.
So retrieve
+ // the data from the table and pass it directly to the new
table.
+ ?>
+ if (mergedOptions.sAjaxSource)
+ {
+ mergedOptions.aaData = oTable.fnGetData();
+ mergedOptions.sAjaxSource = null;
+ }
+ oTable.fnDestroy();
+ oTable = table.dataTable(mergedOptions);
});
return oTable;
}
@@ -1471,8 +1492,8 @@
<?php // Turn the table into a datatable ?>
var tableOptions = new Object();
+ tableOptions.sScrollXInner = "100%";
tableOptions.aoColumnDefs = colDefsMain;
- tableOptions.sScrollXInner = "100%";
<?php
// For some reason I don't understand, fnOpen() doesn't seem to work when
// using FixedColumns. We also have to turn off bStateSave. I have
raised
@@ -1744,27 +1765,8 @@
?>
tableOptions.sAjaxSource = "<?php echo $ajax_url ?>";
tableOptions.aoColumnDefs = [{"sType": "title-numeric", "aTargets":
[2]}];
- <?php
- // Fix the left hand column. This has to be done when initialisation
- // is complete as the language files are loaded asynchronously
- ?>
- tableOptions.fnInitComplete = function(){
- var oFC = new FixedColumns(searchTable, {"iLeftColumns": 1,
- "iLeftWidth": 25,
- "sLeftWidth": "relative"});
- $('.js div.datatable_container').css('visibility', 'visible');
- };
- <?php
- // Remove the first column from the column visibility
- // list because it is fixed
- ?>
- tableOptions.oColVis = {aiExclude: [0]};
- <?php
- // and stop the first column being reordered
- ?>
- tableOptions.oColReorder = {"iFixedColumns": 1};
- var searchTable = makeDataTable('#search_results', tableOptions);
+ var searchTable = makeDataTable('#search_results', tableOptions, 0.33);
<?php
} // if (function_exists('json_encode'))
Modified: mrbs/branches/datatables/web/jquery/datatables/css/mrbs-table.css
===================================================================
--- mrbs/branches/datatables/web/jquery/datatables/css/mrbs-table.css
2011-09-29 22:55:57 UTC (rev 2033)
+++ mrbs/branches/datatables/web/jquery/datatables/css/mrbs-table.css
2011-09-30 09:54:25 UTC (rev 2034)
@@ -35,6 +35,8 @@
.dataTables_wrapper {
position: relative;
min-height: 302px;
+ float: left;
+ width: 100%;
clear: both;
_height: 302px;
zoom: 1; /* Feeling sorry for IE */
@@ -123,6 +125,7 @@
*/
table.display {
margin: 0;
+ float: left;
clear: both;
width: 100%;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits