Browse Source

- Remember panel sizes in Web UI (Cookie based)

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
1c0bc205f0
  1. 21
      src/webui/scripts/client.js

21
src/webui/scripts/client.js

@ -26,15 +26,28 @@ myTable = new dynamicTable();
ajaxfn = function(){}; ajaxfn = function(){};
window.addEvent('domready', function(){ window.addEvent('domready', function(){
var saveColumnSizes = function() {
var filters_width = $('Filters').getSize().x;
var properties_height = $('properties').getSize().y;
// Save it in a cookie
Cookie.write('filters_width', filters_width);
Cookie.write('properties_height', properties_height);
}
MochaUI.Desktop = new MochaUI.Desktop(); MochaUI.Desktop = new MochaUI.Desktop();
MochaUI.Desktop.desktop.setStyles({ MochaUI.Desktop.desktop.setStyles({
'background': '#fff', 'background': '#fff',
'visibility': 'visible' 'visibility': 'visible'
}); });
var filt_w = Cookie.read('filters_width').toInt();
if(!$defined(filt_w))
filt_w = 120;
new MochaUI.Column({ new MochaUI.Column({
id: 'filtersColumn', id: 'filtersColumn',
placement: 'left', placement: 'left',
width: 120, onResize: saveColumnSizes,
width: filt_w,
resizeLimit: [100, 300] resizeLimit: [100, 300]
}); });
new MochaUI.Column({ new MochaUI.Column({
@ -57,15 +70,19 @@ window.addEvent('domready', function(){
loadMethod: 'xhr', loadMethod: 'xhr',
contentURL: 'transferlist.html', contentURL: 'transferlist.html',
column: 'mainColumn', column: 'mainColumn',
onResize: saveColumnSizes,
height: null height: null
}); });
var prop_h = Cookie.read('properties_height').toInt();
if(!$defined(prop_h))
prop_h = 200;
new MochaUI.Panel({ new MochaUI.Panel({
id: 'properties', id: 'properties',
title: 'Panel', title: 'Panel',
loadMethod: 'xhr', loadMethod: 'xhr',
contentURL: 'properties.html', contentURL: 'properties.html',
column: 'mainColumn', column: 'mainColumn',
height: 200 height: prop_h
}); });
initializeWindows(); initializeWindows();
var r=0; var r=0;

Loading…
Cancel
Save