diff --git a/ChangeLog b/ChangeLog index c61c909222..05cad3c65a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ phpMyAdmin - ChangeLog 4.1.3.0 (not yet released) - bug #3938 PDFDefaultPageSize doc and easy configurability - bug #4198 Hovering over pie chart gives fatal JS error ++ rfe #1478 Make Column Headings Sticky 4.1.2.0 (2013-12-23) - bug #4178 Quick edit for BIT type does not work diff --git a/js/chart.js b/js/chart.js index 99944710c0..ac7874f17b 100644 --- a/js/chart.js +++ b/js/chart.js @@ -297,6 +297,11 @@ JQPlotLineChart.prototype.populateOptions = function (dataTable, options) { labelRenderer : $.jqplot.CanvasAxisLabelRenderer } }, + highlighter: { + show: true, + tooltipAxes: 'y', + formatString:'%d' + }, series : [] }; $.extend(true, optional, options); @@ -386,6 +391,11 @@ JQPlotScatterChart.prototype.populateOptions = function (dataTable, options) { labelRenderer : $.jqplot.CanvasAxisLabelRenderer } }, + highlighter: { + show: true, + tooltipAxes: 'xy', + formatString:'%d, %d' + }, series : [] }; for (var i = 1; i < columns.length; i++) { @@ -567,6 +577,11 @@ JQPlotBarChart.prototype.populateOptions = function (dataTable, options) { labelRenderer : $.jqplot.CanvasAxisLabelRenderer } }, + highlighter: { + show: true, + tooltipAxes: 'x', + formatString:'%d' + }, series : [], seriesDefaults : { fillToZero : true @@ -614,6 +629,8 @@ JQPlotPieChart.prototype.constructor = JQPlotPieChart; JQPlotPieChart.prototype.populateOptions = function (dataTable, options) { var optional = { highlighter: { + show: true, + tooltipAxes: 'xy', formatString:'%s, %d', useAxesFormatters: false } diff --git a/js/navigation.js b/js/navigation.js index 8a3bc951ed..05b53e2bcc 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -825,6 +825,9 @@ var ResizeHandler = function () { var pos = event.data.resize_handler.getPos(event); event.data.resize_handler.setWidth(pos); } + if($('#sticky_columns').length !== 0) { + handleStickyColumns(); + } }; /** * Event handler for collapsing the panel diff --git a/js/sql.js b/js/sql.js index 0e0ea829eb..909586f337 100644 --- a/js/sql.js +++ b/js/sql.js @@ -8,6 +8,7 @@ */ var $data_a; +var prevScrollX = 0, fixedTop; /** * decode a string URL_encoded @@ -70,6 +71,7 @@ AJAX.registerTeardown('sql.js', function () { $('#bookmarkQueryForm').die('submit'); $('input#bkm_label').unbind('keyup'); $("#sqlqueryresults").die('makegrid'); + $("#sqlqueryresults").die('stickycolumns'); $("#togglequerybox").unbind('click'); $("#button_submit_query").die('click'); $("input[name=bookmark_variable]").unbind("keypress"); @@ -81,6 +83,7 @@ AJAX.registerTeardown('sql.js', function () { $('a.browse_foreign').die('click'); $('th.column_heading.pointer').die('hover'); $('th.column_heading.marker').die('click'); + $(window).unbind('scroll'); }); /** @@ -147,6 +150,23 @@ AJAX.registerOnload('sql.js', function () { PMA_makegrid($('#table_results')[0]); }); + /* + * Attach a custom event for sticky column headings which will be + * triggered manually everytime the table of results is reloaded + * @memberOf jQuery + */ + $("#sqlqueryresults").live('stickycolumns', function () { + if ($("#table_results").length === 0) { + return; + } + //add sticky columns div + initStickyColumns(); + //adjust sticky columns on scroll + $(window).bind('scroll', function() { + handleStickyColumns(); + }); + }); + /** * Append the "Show/Hide query box" message to the query input form * @@ -325,7 +345,7 @@ AJAX.registerOnload('sql.js', function () { }); } - $sqlqueryresults.show().trigger('makegrid'); + $sqlqueryresults.show().trigger('makegrid').trigger('stickycolumns'); $('#togglequerybox').show(); PMA_init_slider(); @@ -374,7 +394,6 @@ AJAX.registerOnload('sql.js', function () { }); //end displayOptionsForm handler }); // end $() - /** * Starting from some th, change the class of all td under it. * If isAddClass is specified, it will be used to determine whether to add or remove the class. @@ -422,7 +441,7 @@ AJAX.registerOnload('sql.js', function () { /** * create resizable table */ - $("#sqlqueryresults").trigger('makegrid'); + $("#sqlqueryresults").trigger('makegrid').trigger('stickycolumns'); }); /* @@ -483,6 +502,68 @@ function initProfilingTables() }); } +/* + * Set position, left, top, width of sticky_columns div + */ +function setStickyColumnsPosition(position, top, left) { + if ($("#sticky_columns").length !== 0) { + $("#sticky_columns") + .css("position", position) + .css("top", top) + .css("left", left ? left : "auto") + .css("width", $("#table_results").width()); + } +} + +/* + * Initialize sticky columns + */ +function initStickyColumns() { + fixedTop = $('#floating_menubar').height(); + if ($("#sticky_columns").length === 0) { + $('