1
0
Fork 0
forked from 0x2620/oxjs

misc bugfixes

This commit is contained in:
rlx 2011-12-23 09:54:20 +00:00
commit 84e7e794f7
3 changed files with 14 additions and 15 deletions

View file

@ -106,7 +106,7 @@ Ox.Checkbox = function(options, self) {
} else if (key == 'title') { } else if (key == 'title') {
self.$title.options({title: value}); self.$title.options({title: value});
} else if (key == 'value') { } else if (key == 'value') {
self.$button.toggleTitle(); self.$button.toggle();
} else if (key == 'width') { } else if (key == 'width') {
that.css({width: value + 'px'}); that.css({width: value + 'px'});
self.$title && self.$title.options({width: getTitleWidth()}); self.$title && self.$title.options({width: getTitleWidth()});

View file

@ -76,14 +76,14 @@ Ox.Select = function(options, self) {
self.options.items = self.options.items.map(function(item) { self.options.items = self.options.items.map(function(item) {
return Ox.isEmpty(item) ? item : { return Ox.isEmpty(item) ? item : {
id: item.id || item, id: 'id' in item ? item.id : item,
title: item.title || item, title: 'title' in item ? item.title : item,
checked: Ox.toArray(self.options.value).indexOf(item.id || item) > -1 checked: Ox.toArray(self.options.value).indexOf(
'id' in item ? item.id : item
) > -1
}; };
}); });
Ox.Log('Form', 'S.O.V.', '"'+self.options.value+'"', JSON.stringify(self.options.items))
self.optionGroup = new Ox.OptionGroup( self.optionGroup = new Ox.OptionGroup(
self.options.items, self.options.items,
self.options.min, self.options.min,
@ -93,8 +93,6 @@ Ox.Select = function(options, self) {
self.options.items = self.optionGroup.init(); self.options.items = self.optionGroup.init();
self.options.value = self.optionGroup.value(); self.options.value = self.optionGroup.value();
Ox.Log('Form', 'S.O.V.', '"'+self.options.value+'"', JSON.stringify(self.options.items))
if (self.options.label) { if (self.options.label) {
self.$label = Ox.Label({ self.$label = Ox.Label({
overlap: 'right', overlap: 'right',
@ -154,7 +152,6 @@ Ox.Select = function(options, self) {
function changeMenu(data) { function changeMenu(data) {
self.options.value = self.optionGroup.value(); self.options.value = self.optionGroup.value();
Ox.Log('Form', 'changeMenu: ', data, 'value:', self.options.value, 'checked:', self.optionGroup.checked())
self.$title && self.$title.html( self.$title && self.$title.html(
self.options.title ? self.options.title : getItem(self.options.value).title self.options.title ? self.options.title : getItem(self.options.value).title
); );

View file

@ -162,7 +162,6 @@ Ox.TextList = function(options, self) {
id: self.options.id + 'SelectColumns', id: self.options.id + 'SelectColumns',
items: self.options.columns.map(function(column) { items: self.options.columns.map(function(column) {
return { return {
checked: column.visible,
disabled: column.removable === false, disabled: column.removable === false,
id: column.id, id: column.id,
title: column.title title: column.title
@ -170,7 +169,10 @@ Ox.TextList = function(options, self) {
}), }),
max: -1, max: -1,
min: 1, min: 1,
type: 'image' type: 'image',
value: Ox.map(self.options.columns, function(column) {
return column.visible ? column.id : null;
})
}) })
.bindEvent('change', changeColumns) .bindEvent('change', changeColumns)
.appendTo(that.$bar.$element); .appendTo(that.$bar.$element);
@ -265,14 +267,14 @@ Ox.TextList = function(options, self) {
function changeColumns(data) { function changeColumns(data) {
var add, var add,
ids = []; ids = [];
Ox.forEach(data.value, function(column) { Ox.forEach(data.value, function(id) {
var index = getColumnIndexById(column.id); var index = getColumnIndexById(id);
if (!self.options.columns[index].visible) { if (!self.options.columns[index].visible) {
addColumn(column.id); addColumn(id);
add = true; add = true;
return false; return false;
} }
ids.push(column.id); ids.push(id);
}); });
if (!add) { if (!add) {
Ox.forEach(self.visibleColumns, function(column) { Ox.forEach(self.visibleColumns, function(column) {