Add buttons to expand/collapse/resize data table

This commit is contained in:
Carlos Salaverria 2016-08-18 15:48:57 -05:00
parent 56397d6d78
commit fe2f837217
7 changed files with 224 additions and 141 deletions

View file

@ -197,6 +197,19 @@ function initialize() {
$("#loader").removeClass("hidden");
// Set up map/sidebar splitter
$("#sidebar_container").resizable({handles: {w: '#splitter'}});
// Set up event handler for expand/collapse sidebar button
$("#toggle_sidebar_button").click(toggleSidebarVisibility);
// Force map to redraw if sidebar container is resized - use a timer to debounce
var mapResizeTimeout;
$("#sidebar_container").on("resize", function() {
clearTimeout(mapResizeTimeout);
mapResizeTimeout = setTimeout(updateMapSize, 50);
});
// Get receiver metadata, reconfigure using it, then continue
// with initialization
$.ajax({ url: 'data/receiver.json',
@ -929,3 +942,15 @@ function resetMap() {
selectPlaneByHex(null,false);
}
function updateMapSize() {
OLMap.updateSize();
}
function toggleSidebarVisibility(e) {
e.preventDefault();
$("#sidebar_container").toggle();
$("#toggle_sidebar_button").toggleClass("show_sidebar");
$("#toggle_sidebar_button").toggleClass("hide_sidebar");
updateMapSize();
}