forked from 0x2620/oxjs
remove unneeded Ox. prefix from path and file names
This commit is contained in:
parent
4138e4e558
commit
51696562f1
1365 changed files with 43 additions and 43 deletions
55
source/UI/js/List/ListItem.js
Normal file
55
source/UI/js/List/ListItem.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
'use strict';
|
||||
|
||||
/*@
|
||||
Ox.ListItem <f> ListItem Object
|
||||
options <o> Options object
|
||||
construct <f> construct function
|
||||
data <o|{}> item data
|
||||
draggable <b|false> can be dragged
|
||||
position <n|0> item position
|
||||
unique <s|''> unique key
|
||||
self <o> Shared private variable
|
||||
([options[, self]]) -> <o:Ox.Element> ListItem Object
|
||||
cancel <!> triggered if cancel button is pressed
|
||||
save <!> triggered if save button is pressed
|
||||
@*/
|
||||
|
||||
Ox.ListItem = function(options, self) {
|
||||
|
||||
self = self || {};
|
||||
var that = Ox.Element({}, self)
|
||||
.defaults({
|
||||
construct: null,
|
||||
data: {},
|
||||
draggable: false,
|
||||
position: 0,
|
||||
unique: ''
|
||||
})
|
||||
.options(options || {})
|
||||
.update({
|
||||
data: function() {
|
||||
constructItem(true);
|
||||
},
|
||||
position: function() {
|
||||
that.data({position: self.options.position});
|
||||
}
|
||||
});
|
||||
|
||||
constructItem();
|
||||
|
||||
function constructItem(update) {
|
||||
var $element = self.options.construct(self.options.data)
|
||||
.addClass('OxItem')
|
||||
.data({
|
||||
id: self.options.data[self.options.unique],
|
||||
position: self.options.position
|
||||
});
|
||||
if (update) {
|
||||
that.hasClass('OxSelected') && $element.addClass('OxSelected');
|
||||
}
|
||||
that.setElement($element);
|
||||
}
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue