add ObjectInput
This commit is contained in:
parent
86fda9f279
commit
ccdad6c05d
1 changed files with 39 additions and 0 deletions
39
source/Ox.UI/js/Form/Ox.ObjectInput.js
Normal file
39
source/Ox.UI/js/Form/Ox.ObjectInput.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
Ox.ObjectInput = function(options, self) {
|
||||
|
||||
self = self || {};
|
||||
var that = Ox.Element({}, self)
|
||||
.defaults({
|
||||
elements: [],
|
||||
labelWidth: 128,
|
||||
width: 256
|
||||
})
|
||||
.options(options || {})
|
||||
.addClass('OxObjectInput')
|
||||
.css({
|
||||
width: self.options.width + 'px',
|
||||
height: self.options.elements.length * 24 - 8 + 'px'
|
||||
});
|
||||
|
||||
Ox.print('ObjI', self.options)
|
||||
|
||||
self.options.elements.forEach(function($element) {
|
||||
$element.options({
|
||||
labelWidth: self.options.labelWidth,
|
||||
width: self.options.width
|
||||
})
|
||||
.appendTo(that);
|
||||
});
|
||||
|
||||
that.value = function() {
|
||||
var value = {};
|
||||
self.options.elements.forEach(function(element) {
|
||||
value[element.options('id')] = element.value();
|
||||
});
|
||||
return value;
|
||||
};
|
||||
|
||||
return that;
|
||||
|
||||
};
|
Loading…
Reference in a new issue