self.setOption ~> that.update
This commit is contained in:
parent
9ee0742b53
commit
005d50c389
56 changed files with 919 additions and 933 deletions
|
|
@ -34,6 +34,12 @@ Ox.Chart = function(options, self) {
|
|||
width: 512
|
||||
})
|
||||
.options(options || {})
|
||||
.update({
|
||||
width: function() {
|
||||
self.$chart.empty();
|
||||
renderChart();
|
||||
}
|
||||
})
|
||||
.addClass('OxChart')
|
||||
.css({
|
||||
width: self.options.width + 'px',
|
||||
|
|
@ -266,13 +272,6 @@ Ox.Chart = function(options, self) {
|
|||
return $element;
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'width') {
|
||||
self.$chart.empty();
|
||||
renderChart();
|
||||
}
|
||||
}
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -49,7 +49,19 @@ Ox.IconList = function(options, self) {
|
|||
sort: [],
|
||||
unique: ''
|
||||
})
|
||||
.options(options || {});
|
||||
.options(options || {})
|
||||
.update({
|
||||
items: function() {
|
||||
that.$element.options('items', self.options.items);
|
||||
},
|
||||
selected: function() {
|
||||
that.$element.options('selected', self.options.selected);
|
||||
},
|
||||
sort: function() {
|
||||
updateKeys();
|
||||
that.$element.options('sort', self.options.sort);
|
||||
}
|
||||
});
|
||||
|
||||
if (self.options.fixedRatio) {
|
||||
self.options.defaultRatio = self.options.fixedRatio;
|
||||
|
|
@ -127,21 +139,6 @@ Ox.IconList = function(options, self) {
|
|||
});
|
||||
}
|
||||
|
||||
/*@
|
||||
setOption <f> set key/value
|
||||
(key, value) -> <u> set key in options to value
|
||||
@*/
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'items') {
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'selected') {
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'sort') {
|
||||
updateKeys();
|
||||
that.$element.options(key, value);
|
||||
}
|
||||
};
|
||||
|
||||
/*@
|
||||
closePreview <f> close preview
|
||||
() -> <o> the list
|
||||
|
|
|
|||
|
|
@ -26,6 +26,30 @@ Ox.InfoList = function(options, self) {
|
|||
unique: ''
|
||||
})
|
||||
.options(options || {})
|
||||
.update({
|
||||
items: function() {
|
||||
that.$element.options('items', self.options.items);
|
||||
},
|
||||
selected: function() {
|
||||
that.$element.options('selected', self.options.selected);
|
||||
},
|
||||
sort: function() {
|
||||
updateKeys();
|
||||
that.$element.options('sort', self.options.sort);
|
||||
},
|
||||
width: function() {
|
||||
var width = getItemWidth();
|
||||
$('.OxInfoElement').each(function() {
|
||||
var $parent = $(this).parent(),
|
||||
id = parseInt(/OxId(.*?)$/.exec(this.className)[1]);
|
||||
$parent.css({width: width - 144});
|
||||
$parent.parent().css({width: width - 144});
|
||||
$parent.parent().parent().css({width: width - 8});
|
||||
Ox.Log('List', '@@@', this.className, id)
|
||||
Ox.UI.elements[id].options({width: width - 152});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//Ox.print('INFO LIST FIND', self.options.find);
|
||||
|
||||
|
|
@ -154,30 +178,8 @@ Ox.InfoList = function(options, self) {
|
|||
});
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'items') {
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'selected') {
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'sort') {
|
||||
updateKeys();
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'width') {
|
||||
var width = getItemWidth();
|
||||
$('.OxInfoElement').each(function() {
|
||||
var $parent = $(this).parent(),
|
||||
id = parseInt(/OxId(.*?)$/.exec(this.className)[1]);
|
||||
$parent.css({width: width - 144});
|
||||
$parent.parent().css({width: width - 144});
|
||||
$parent.parent().parent().css({width: width - 8});
|
||||
Ox.Log('List', '@@@', this.className, id)
|
||||
Ox.UI.elements[id].options({width: width - 152});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/*@
|
||||
closePreivew <f> closePreview
|
||||
closePreview <f> closePreview
|
||||
@*/
|
||||
that.closePreview = function() {
|
||||
that.$element.closePreview();
|
||||
|
|
|
|||
|
|
@ -71,6 +71,38 @@ Ox.List = function(options, self) {
|
|||
unique: ''
|
||||
})
|
||||
.options(options || {})
|
||||
.update({
|
||||
items: function() {
|
||||
if (Ox.isArray(self.options.items)) {
|
||||
self.options.items = Ox.api(self.options.items, {
|
||||
cache: true,
|
||||
sort: self.options.sort,
|
||||
sums: self.options.sums,
|
||||
unique: self.options.unique
|
||||
});
|
||||
/*
|
||||
self.listLength = self.options.items.length;
|
||||
updateSelected();
|
||||
updateSort();
|
||||
*/
|
||||
}
|
||||
updateQuery();
|
||||
},
|
||||
selected: function() {
|
||||
var previousSelected = self.selected;
|
||||
setSelected(self.options.selected);
|
||||
// fixme: the following was added in order
|
||||
// to make text list find-as-you-type work,
|
||||
// this may break other things
|
||||
if (!self.isAsync && !Ox.isEqual(self.selected, previousSelected)) {
|
||||
triggerSelectEvent(self.options.selected);
|
||||
}
|
||||
},
|
||||
sort: function() {
|
||||
//Ox.Log('List', '---sort---')
|
||||
updateSort();
|
||||
}
|
||||
})
|
||||
.scroll(scroll);
|
||||
|
||||
self.options.sort = self.options.sort.map(function(sort) {
|
||||
|
|
@ -1394,39 +1426,6 @@ Ox.List = function(options, self) {
|
|||
//}
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
//Ox.Log('List', 'list setOption', key, value);
|
||||
var previousSelected;
|
||||
if (key == 'items') {
|
||||
if (Ox.isArray(value)) {
|
||||
self.options.items = Ox.api(self.options.items, {
|
||||
cache: true,
|
||||
sort: self.options.sort,
|
||||
sums: self.options.sums,
|
||||
unique: self.options.unique
|
||||
});
|
||||
/*
|
||||
self.listLength = value.length;
|
||||
updateSelected();
|
||||
updateSort();
|
||||
*/
|
||||
}
|
||||
updateQuery();
|
||||
} else if (key == 'selected') {
|
||||
previousSelected = self.selected;
|
||||
setSelected(value);
|
||||
// fixme: the following was added in order
|
||||
// to make text list find-as-you-type work,
|
||||
// this may break other things
|
||||
if (!self.isAsync && !Ox.isEqual(self.selected, previousSelected)) {
|
||||
triggerSelectEvent(value);
|
||||
}
|
||||
} else if (key == 'sort') {
|
||||
//Ox.Log('List', '---sort---')
|
||||
updateSort();
|
||||
}
|
||||
};
|
||||
|
||||
/*@
|
||||
addItems <f> add item to list
|
||||
(pos, items) -> <u> add items to list at position
|
||||
|
|
|
|||
|
|
@ -25,7 +25,12 @@ Ox.ListItem = function(options, self) {
|
|||
position: 0,
|
||||
unique: ''
|
||||
})
|
||||
.options(options || {});
|
||||
.options(options || {})
|
||||
.update({
|
||||
data: function() {
|
||||
constructItem(true);
|
||||
}
|
||||
});
|
||||
|
||||
constructItem();
|
||||
|
||||
|
|
@ -42,12 +47,6 @@ Ox.ListItem = function(options, self) {
|
|||
that.setElement($element);
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'data') {
|
||||
constructItem(true);
|
||||
}
|
||||
};
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,6 +69,21 @@ Ox.TextList = function(options, self) {
|
|||
sums: []
|
||||
})
|
||||
.options(options || {})
|
||||
.update({
|
||||
items: function() {
|
||||
that.$body.options('items', self.options.items);
|
||||
},
|
||||
paste: function() {
|
||||
that.$body.options('paste', self.options.paste);
|
||||
},
|
||||
selected: function() {
|
||||
that.$body.options('selected', self.options.selected);
|
||||
},
|
||||
sort: function() {
|
||||
updateColumn();
|
||||
that.$body.options('sort', self.options.sort);
|
||||
}
|
||||
})
|
||||
.addClass('OxTextList')
|
||||
.bindEvent({
|
||||
key_left: function() {
|
||||
|
|
@ -816,20 +831,6 @@ Ox.TextList = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
//Ox.Log('List', '---------------------------- TextList setOption', key, value)
|
||||
if (key == 'items') {
|
||||
that.$body.options(key, value);
|
||||
} else if (key == 'paste') {
|
||||
that.$body.options(key, value);
|
||||
} else if (key == 'selected') {
|
||||
that.$body.options(key, value);
|
||||
} else if (key == 'sort') {
|
||||
updateColumn();
|
||||
that.$body.options(key, value);
|
||||
}
|
||||
};
|
||||
|
||||
that.addItem = function(item) {
|
||||
/*
|
||||
self.options.items.push(item);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,20 @@ Ox.TreeList = function(options, self) {
|
|||
selected: [],
|
||||
width: 'auto'
|
||||
})
|
||||
.options(options || {});
|
||||
.options(options || {})
|
||||
.update({
|
||||
data: function() {
|
||||
// ...
|
||||
},
|
||||
selected: function() {
|
||||
//self.$list.options({selected: self.options.selected});
|
||||
selectItem({ids: self.options.selected});
|
||||
self.$list.scrollToSelection();
|
||||
},
|
||||
width: function() {
|
||||
// ...
|
||||
}
|
||||
});
|
||||
|
||||
if (self.options.data) {
|
||||
self.options.items = [];
|
||||
|
|
@ -249,18 +262,6 @@ Ox.TreeList = function(options, self) {
|
|||
});
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'data') {
|
||||
// ...
|
||||
} else if (key == 'selected') {
|
||||
//self.$list.options({selected: value});
|
||||
selectItem({ids: value});
|
||||
self.$list.scrollToSelection();
|
||||
} else if (key == 'width') {
|
||||
// ...
|
||||
}
|
||||
};
|
||||
|
||||
/*@
|
||||
gainFocus <f> gainFocus
|
||||
@*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue