From ccdad6c05d7c27bce79f03b43ff02c81c7c0baa2 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 30 Nov 2011 15:50:55 +0100 Subject: [PATCH] add ObjectInput --- source/Ox.UI/js/Form/Ox.ObjectInput.js | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 source/Ox.UI/js/Form/Ox.ObjectInput.js diff --git a/source/Ox.UI/js/Form/Ox.ObjectInput.js b/source/Ox.UI/js/Form/Ox.ObjectInput.js new file mode 100644 index 00000000..4a9035c9 --- /dev/null +++ b/source/Ox.UI/js/Form/Ox.ObjectInput.js @@ -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; + +}; \ No newline at end of file