Compare commits

..

No commits in common. "6252e27f6c2f75bdc55f3585b60f2d75220d6df7" and "ac1a4ef961e6e2d4a6c383579fbd7d30c6345b8c" have entirely different histories.

View file

@ -15,18 +15,11 @@ Ox.FormPanel = function(options, self) {
var that = Ox.Element({}, self) var that = Ox.Element({}, self)
.defaults({ .defaults({
form: [], form: [],
listSize: 256, listSize: 256
section: null
}) })
.options(options || {}) .options(options || {});
.update({
section: setSection
});
if (self.options.section === null) { self.section = 0;
self.options.section = self.options.form[0].id;
}
self.section = Ox.getIndexById(self.options.form, self.optoins.section);
self.sectionTitle = self.options.form[self.section].title; self.sectionTitle = self.options.form[self.section].title;
self.$list = Ox.TableList({ self.$list = Ox.TableList({
columns: [ columns: [
@ -69,7 +62,7 @@ Ox.FormPanel = function(options, self) {
}), }),
max: 1, max: 1,
min: 1, min: 1,
selected: [self.options.selected], selected: [self.options.form[0].id],
sort: [{key: 'id', operator: '+'}], sort: [{key: 'id', operator: '+'}],
unique: 'id', unique: 'id',
width: self.options.listSize width: self.options.listSize
@ -137,18 +130,7 @@ Ox.FormPanel = function(options, self) {
}); });
}); });
self.$sections[self.section].show(); self.$sections[0].show();
function setSection() {
var id = self.options.section,
section = Ox.getIndexById(self.options.form, id);
if (self.section != section) {
self.$sections[self.section].hide();
self.section = section;
self.$list.options('selected', [id]);
self.$sections[self.section].show();
}
};
that.setElement(Ox.SplitPanel({ that.setElement(Ox.SplitPanel({
elements: [ elements: [
@ -209,24 +191,13 @@ Ox.FormPanel = function(options, self) {
values <f> values values <f> values
@*/ @*/
that.values = function() { that.values = function() {
if (arguments.length === 0) { var values = {};
var values = {}; self.options.form.forEach(function(section, i) {
self.options.form.forEach(function(section, i) { values[section.id] = self.$forms[i].values();
values[section.id] = self.$forms[i].values(); });
}); return values;
return values;
} else {
var sections = arguments[0];
self.options.form.forEach(function(form, i) {
if ((form.id in sections) {
self.$forms[i].values(sections[form.id]);
}
});
}
}; };
return that; return that;
}; };