workaround for select values not getting updated correctly when updating form values
This commit is contained in:
parent
e5d0c3fd20
commit
f43122f795
4 changed files with 39 additions and 24 deletions
|
@ -484,7 +484,7 @@ Ox.ListCalendar = function(options, self) {
|
||||||
selectEvent(event);
|
selectEvent(event);
|
||||||
self.$nameInput.focusInput();
|
self.$nameInput.focusInput();
|
||||||
} else {
|
} else {
|
||||||
alert(result.status.code)
|
alert(result.status.text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -495,6 +495,7 @@ Ox.ListCalendar = function(options, self) {
|
||||||
data = {id: id};
|
data = {id: id};
|
||||||
data[key] = value;
|
data[key] = value;
|
||||||
self.options.editEvent(data, function(result) {
|
self.options.editEvent(data, function(result) {
|
||||||
|
if (result.status.code == 200) {
|
||||||
self.options.events[index][key] = value;
|
self.options.events[index][key] = value;
|
||||||
self.$list.value(id, key, value);
|
self.$list.value(id, key, value);
|
||||||
if (['name', 'type', 'start', 'end'].indexOf(key) > -1) {
|
if (['name', 'type', 'start', 'end'].indexOf(key) > -1) {
|
||||||
|
@ -512,6 +513,9 @@ Ox.ListCalendar = function(options, self) {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
alert(result.status.text);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,12 +550,16 @@ Ox.ListCalendar = function(options, self) {
|
||||||
var id = self.selectedEvent,
|
var id = self.selectedEvent,
|
||||||
index = Ox.getPositionById(self.options.events, id);
|
index = Ox.getPositionById(self.options.events, id);
|
||||||
self.options.removeEvent({id: id}, function(result) {
|
self.options.removeEvent({id: id}, function(result) {
|
||||||
|
if (result.status.code == '200') {
|
||||||
self.options.events.splice(index, 1);
|
self.options.events.splice(index, 1);
|
||||||
var time0 = +new Date();
|
var time0 = +new Date();
|
||||||
self.$list.options({items: Ox.clone(self.options.events, true)});
|
self.$list.options({items: Ox.clone(self.options.events, true)});
|
||||||
Ox.print('TIME TO SET LIST OPTIONS:', +new Date() - time0);
|
Ox.print('TIME TO SET LIST OPTIONS:', +new Date() - time0);
|
||||||
self.$calendar.removeEvent();
|
self.$calendar.removeEvent();
|
||||||
selectEvent({});
|
selectEvent({});
|
||||||
|
} else {
|
||||||
|
alert(result.status.text);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ Ox.Form = function(options, self) {
|
||||||
//Ox.print('VALUES', values)
|
//Ox.print('VALUES', values)
|
||||||
return values;
|
return values;
|
||||||
} else {
|
} else {
|
||||||
|
Ox.print('SET FORM VALUES', arguments[0])
|
||||||
Ox.forEach(arguments[0], function(value, key) {
|
Ox.forEach(arguments[0], function(value, key) {
|
||||||
var index = getItemIndexById(key);
|
var index = getItemIndexById(key);
|
||||||
//index > -1 && Ox.print(':::::::', key, value)
|
//index > -1 && Ox.print(':::::::', key, value)
|
||||||
|
|
|
@ -43,11 +43,12 @@ Ox.Select = function(options, self) {
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
title: '',
|
title: '',
|
||||||
type: 'text', // can be 'text' or 'image'
|
type: 'text', // can be 'text' or 'image'
|
||||||
value: [],
|
value: '',
|
||||||
width: 'auto'
|
width: 'auto'
|
||||||
})
|
})
|
||||||
// fixme: make default selection restorable
|
// fixme: make default selection restorable
|
||||||
// or allow for extra action items below options
|
// or allow for extra action items below options
|
||||||
|
// fixme: passing value has no effect
|
||||||
.options(options)
|
.options(options)
|
||||||
.addClass(
|
.addClass(
|
||||||
'OxSelect Ox' + Ox.toTitleCase(self.options.size) + (
|
'OxSelect Ox' + Ox.toTitleCase(self.options.size) + (
|
||||||
|
@ -148,6 +149,7 @@ Ox.Select = function(options, self) {
|
||||||
function changeMenu(data) {
|
function changeMenu(data) {
|
||||||
//Ox.print('clickMenu: ', self.options.id, data)
|
//Ox.print('clickMenu: ', self.options.id, data)
|
||||||
self.checked = self.optionGroup.checked();
|
self.checked = self.optionGroup.checked();
|
||||||
|
self.options.value = data.checked[0].id;
|
||||||
self.$title && self.$title.html(
|
self.$title && self.$title.html(
|
||||||
self.options.title ? self.options.title :
|
self.options.title ? self.options.title :
|
||||||
data.checked[0].title
|
data.checked[0].title
|
||||||
|
@ -182,6 +184,8 @@ Ox.Select = function(options, self) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// FIXME: selected() _and_ selectItem() _and_ value() ???
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
selected <f> gets selected item
|
selected <f> gets selected item
|
||||||
() -> <o> returns object of selected items with id, title
|
() -> <o> returns object of selected items with id, title
|
||||||
|
|
|
@ -335,10 +335,12 @@ Ox.Dialog = function(options, self) {
|
||||||
left: left,
|
left: left,
|
||||||
top: top
|
top: top
|
||||||
}), animate);
|
}), animate);
|
||||||
|
/*
|
||||||
that.triggerEvent('resize', {
|
that.triggerEvent('resize', {
|
||||||
width: self.options.width,
|
width: self.options.width,
|
||||||
height: self.options.height
|
height: self.options.height
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function resizestart(event) {
|
function resizestart(event) {
|
||||||
|
|
Loading…
Reference in a new issue