table list columns: add 'addable' property (defaults to true, like removable)

This commit is contained in:
rlx 2013-07-20 07:57:13 +00:00
parent 8c6803dc0e
commit ce579b8f3f

View file

@ -7,12 +7,13 @@ Ox.TableList <f> TableList Widget
clearButtonTooltip <s|''> Clear button tooltip clearButtonTooltip <s|''> Clear button tooltip
columns <[o]|[]> Columns columns <[o]|[]> Columns
# Fixme: There's probably more... # Fixme: There's probably more...
addable <b|true> ...
align <s|'left'> ... align <s|'left'> ...
editable <b> ... editable <b> ...
format <f> ... format <f> ...
id <s> ... id <s> ...
operator <s> default sort operator operator <s> default sort operator
removable <b> ... removable <b|true> ...
resizable <b> ... resizable <b> ...
sort <f> function(value, object) that maps values to sort values sort <f> function(value, object) that maps values to sort values
title <s> ... title <s> ...
@ -211,7 +212,9 @@ Ox.TableList = function(options, self) {
if (self.options.columnsRemovable) { if (self.options.columnsRemovable) {
that.$select = Ox.Select({ that.$select = Ox.Select({
id: self.options.id + 'SelectColumns', id: self.options.id + 'SelectColumns',
items: self.options.columns.map(function(column) { items: self.options.columns.filter(function(column){
return column.addable !== false;
}).map(function(column) {
return { return {
disabled: column.removable === false, disabled: column.removable === false,
id: column.id, id: column.id,
@ -489,7 +492,7 @@ Ox.TableList = function(options, self) {
$('<div>').appendTo($resize); $('<div>').appendTo($resize);
$('<div>').addClass('OxCenter').appendTo($resize); $('<div>').addClass('OxCenter').appendTo($resize);
$('<div>').appendTo($resize); $('<div>').appendTo($resize);
// if columns are resizable, bind click and drag events // if columns are resizable, bind doubleclick and drag events
if (self.options.columnsResizable && column.resizable !== false) { if (self.options.columnsResizable && column.resizable !== false) {
$resize.addClass('OxResizable') $resize.addClass('OxResizable')
.bindEvent({ .bindEvent({