fix FormPanel selections
This commit is contained in:
parent
fb6c862b88
commit
9a7c3144f5
1 changed files with 6 additions and 3 deletions
|
@ -69,7 +69,7 @@ Ox.FormPanel = function(options, self) {
|
||||||
}),
|
}),
|
||||||
max: 1,
|
max: 1,
|
||||||
min: 1,
|
min: 1,
|
||||||
selected: [self.options.selected],
|
selected: [self.options.section],
|
||||||
sort: [{key: 'id', operator: '+'}],
|
sort: [{key: 'id', operator: '+'}],
|
||||||
unique: 'id',
|
unique: 'id',
|
||||||
width: self.options.listSize
|
width: self.options.listSize
|
||||||
|
@ -77,6 +77,9 @@ Ox.FormPanel = function(options, self) {
|
||||||
select: function(data) {
|
select: function(data) {
|
||||||
self.$sections[self.section].hide();
|
self.$sections[self.section].hide();
|
||||||
self.section = Ox.getIndexById(self.options.form, data.ids[0]);
|
self.section = Ox.getIndexById(self.options.form, data.ids[0]);
|
||||||
|
if (self.section == -1) {
|
||||||
|
self.section = 0
|
||||||
|
}
|
||||||
self.$sections[self.section].show();
|
self.$sections[self.section].show();
|
||||||
that.triggerEvent('select', {section: data.ids[0]});
|
that.triggerEvent('select', {section: data.ids[0]});
|
||||||
}
|
}
|
||||||
|
@ -142,7 +145,7 @@ Ox.FormPanel = function(options, self) {
|
||||||
function setSection() {
|
function setSection() {
|
||||||
var id = self.options.section,
|
var id = self.options.section,
|
||||||
section = Ox.getIndexById(self.options.form, id);
|
section = Ox.getIndexById(self.options.form, id);
|
||||||
if (self.section != section) {
|
if (section > -1 && self.section != section) {
|
||||||
self.$sections[self.section].hide();
|
self.$sections[self.section].hide();
|
||||||
self.section = section;
|
self.section = section;
|
||||||
self.$list.options('selected', [id]);
|
self.$list.options('selected', [id]);
|
||||||
|
@ -219,7 +222,7 @@ Ox.FormPanel = function(options, self) {
|
||||||
var sections = arguments[0];
|
var sections = arguments[0];
|
||||||
|
|
||||||
self.options.form.forEach(function(form, i) {
|
self.options.form.forEach(function(form, i) {
|
||||||
if ((form.id in sections) {
|
if (form.id in sections) {
|
||||||
self.$forms[i].values(sections[form.id]);
|
self.$forms[i].values(sections[form.id]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue