improved handling of booking falling out of context after edit/delete
This commit is contained in:
parent
ab0b0d5300
commit
89873f0c4d
1 changed files with 32 additions and 26 deletions
|
@ -92,32 +92,12 @@ oml.ui.browser = function() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
select: function(data) {
|
select: function(data) {
|
||||||
if (ui.item) {
|
if (ui.item && data.ids.length) {
|
||||||
if (data.ids.length) {
|
oml.UI.set({
|
||||||
oml.UI.set({
|
item: data.ids[0],
|
||||||
item: data.ids[0],
|
itemView: 'info',
|
||||||
itemView: 'info',
|
listSelection: data.ids
|
||||||
listSelection: data.ids
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// no longer in context after edit
|
|
||||||
oml.api.find({
|
|
||||||
query: {conditions: [], operator: '&'},
|
|
||||||
positions: [ui.item]
|
|
||||||
}, function(result) {
|
|
||||||
if (result.data.positions[ui.item] === void 0) {
|
|
||||||
// no longer in libraries after delete
|
|
||||||
oml.UI.set({item: ''});
|
|
||||||
} else {
|
|
||||||
oml.stayInItemView = true;
|
|
||||||
oml.UI.set({
|
|
||||||
find: {conditions: [], operator: '&'},
|
|
||||||
listSelection: [ui.item]
|
|
||||||
});
|
|
||||||
oml.stayInItemView = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle: function(data) {
|
toggle: function(data) {
|
||||||
|
@ -144,6 +124,32 @@ oml.ui.browser = function() {
|
||||||
if (data.value.length) {
|
if (data.value.length) {
|
||||||
that.options({selected: [data.value[0]]});
|
that.options({selected: [data.value[0]]});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// no longer in context after edit
|
||||||
|
Ox.print('OUT OF CONTEXT')
|
||||||
|
oml.api.find({
|
||||||
|
query: {conditions: [], operator: '&'},
|
||||||
|
positions: [ui.item]
|
||||||
|
}, function(result) {
|
||||||
|
if (result.data.positions[ui.item] === void 0) {
|
||||||
|
// no longer in libraries after delete
|
||||||
|
oml.UI.set({
|
||||||
|
find: {conditions: [], operator: '&'},
|
||||||
|
item: '',
|
||||||
|
listSelection: []
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Ox.Request.clearCache('find');
|
||||||
|
oml.stayInItemView = true;
|
||||||
|
oml.UI.set({
|
||||||
|
find: {conditions: [], operator: '&'},
|
||||||
|
item: ui.item,
|
||||||
|
listSelection: [ui.item]
|
||||||
|
});
|
||||||
|
oml.stayInItemView = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
oml_listsort: function(data) {
|
oml_listsort: function(data) {
|
||||||
that.options({sort: data.value});
|
that.options({sort: data.value});
|
||||||
|
|
Loading…
Reference in a new issue