Ox.CustomList: add public 'selectPosition' and 'size' methods, add 'resize' option (fn(, width) that runs for each item, on resize)
This commit is contained in:
parent
10eafb0bd4
commit
087c7eb956
1 changed files with 28 additions and 1 deletions
|
@ -20,6 +20,7 @@ Ox.CustomList = function(options, self) {
|
||||||
min: 0,
|
min: 0,
|
||||||
pageLength: 100,
|
pageLength: 100,
|
||||||
query: {conditions: [], operator: '&'},
|
query: {conditions: [], operator: '&'},
|
||||||
|
resize: null,
|
||||||
scrollbarVisible: false,
|
scrollbarVisible: false,
|
||||||
selected: [],
|
selected: [],
|
||||||
sort: [],
|
sort: [],
|
||||||
|
@ -32,6 +33,14 @@ Ox.CustomList = function(options, self) {
|
||||||
items: function() {
|
items: function() {
|
||||||
self.$list.options({items: self.options.items});
|
self.$list.options({items: self.options.items});
|
||||||
},
|
},
|
||||||
|
itemWidth: function() {
|
||||||
|
var width = self.options.itemWidth - Ox.UI.SCROLLBAR_SIZE;
|
||||||
|
if (self.options.resize) {
|
||||||
|
that.$element.find('.OxItem').each(function(element) {
|
||||||
|
self.options.resize($(this), width);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
selected: function() {
|
selected: function() {
|
||||||
self.$list.options({selected: self.options.selected});
|
self.$list.options({selected: self.options.selected});
|
||||||
// FIXME: TableList doesn't trigger event here
|
// FIXME: TableList doesn't trigger event here
|
||||||
|
@ -42,7 +51,9 @@ Ox.CustomList = function(options, self) {
|
||||||
|
|
||||||
self.$list = Ox.List({
|
self.$list = Ox.List({
|
||||||
construct: function(data) {
|
construct: function(data) {
|
||||||
return self.options.item(data, self.options.itemWidth - Ox.UI.SCROLLBAR_SIZE).addClass('OxTarget');
|
return self.options.item(
|
||||||
|
data, self.options.itemWidth - Ox.UI.SCROLLBAR_SIZE
|
||||||
|
).addClass('OxTarget');
|
||||||
},
|
},
|
||||||
draggable: self.options.draggable,
|
draggable: self.options.draggable,
|
||||||
itemHeight: self.options.itemHeight,
|
itemHeight: self.options.itemHeight,
|
||||||
|
@ -99,6 +110,22 @@ Ox.CustomList = function(options, self) {
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*@
|
||||||
|
selectPosition <f> select position
|
||||||
|
@*/
|
||||||
|
that.selectPosition = function(pos) {
|
||||||
|
self.$list.selectPosition(pos);
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*@
|
||||||
|
size <f> size
|
||||||
|
@*/
|
||||||
|
that.size = function() {
|
||||||
|
self.$list.size();
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
||||||
};
|
};
|
Loading…
Reference in a new issue