summaryrefslogtreecommitdiffstats
path: root/install/ui/widget.js
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-06-01 12:14:53 -0400
committerAdam Young <ayoung@redhat.com>2011-06-02 14:28:24 -0400
commit7486a332211ed13318c0a689657cb4ff7e7d25a3 (patch)
tree8a6615df0fcd165cede3f7674be407a30516d35e /install/ui/widget.js
parent585083c1d7a0069579d45b17adb39ad8f522c3f6 (diff)
downloadfreeipa-7486a332211ed13318c0a689657cb4ff7e7d25a3.tar.gz
freeipa-7486a332211ed13318c0a689657cb4ff7e7d25a3.tar.xz
freeipa-7486a332211ed13318c0a689657cb4ff7e7d25a3.zip
scrollable content areas
Turn off the side scroll bars for pages. Resizes the table when the browser resizes For stables, the rows scroll, but not the header. For details, the content area scrolls. Reserves 400 picesl for the header/ footer. Resize is only done on reload
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r--install/ui/widget.js33
1 files changed, 29 insertions, 4 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 1c12ac480..9cbd31f0a 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -23,6 +23,8 @@
/* REQUIRES: ipa.js */
+IPA.checkbox_column_width = 22;
+
IPA.widget = function(spec) {
spec = spec || {};
@@ -1141,13 +1143,22 @@ IPA.table_widget = function (spec) {
th = $('<th/>').appendTo(tr);
- if (that.scrollable && (i == columns.length-1)) {
+ if (that.scrollable ) {
+ var width;
if (column.width) {
- var width = parseInt(
+ width = parseInt(
column.width.substring(0, column.width.length-2),10);
width += 16;
- th.css('width', width+'px');
+ }else{
+ /* don't use the checkbox column as part of the overall
+ calculation for column widths. It is so small
+ that it throws off the average. */
+ width = (that.table.width() - IPA.checkbox_column_width) /
+ (columns.length);
}
+ width += 'px';
+ th.css('width', width);
+ column.width = width;
} else {
if (column.width) {
th.css('width', column.width);
@@ -1167,6 +1178,9 @@ IPA.table_widget = function (spec) {
'style': 'float: right;'
}).appendTo(th);
}
+ if (that.scrollable && !column.width){
+ column.width = th.width() +'px';
+ }
}
that.tbody = $('<tbody/>').appendTo(that.table);
@@ -1178,7 +1192,7 @@ IPA.table_widget = function (spec) {
that.row = $('<tr/>');
var td = $('<td/>', {
- 'style': 'width: 22px;'
+ 'style': 'width: '+ IPA.checkbox_column_width +'px;'
}).appendTo(that.row);
$('<input/>', {
@@ -1268,6 +1282,7 @@ IPA.table_widget = function (spec) {
name: 'total_pages'
}).appendTo(that.pagination);
}
+ that.resize();
};
that.select_changed = function(){
@@ -1282,6 +1297,16 @@ IPA.table_widget = function (spec) {
that.tbody.empty();
};
+ that.resize = function(){
+ if (that.scrollable){
+ that.tbody.attr('overflow-y', 'auto');
+ that.tbody.height("auto");
+ var table_max_height = $(window).height() -
+ IPA.reserved_screen_size;
+ that.tbody.height(table_max_height);
+ }
+ };
+
that.load = function(result) {
that.empty();