when an e-mail is selected and an action goes through,
select the e-mail on the position the old one was,
this way, one does not have to reselect an e-mail after
an action is done
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
load: function(callback) {
var me = this;
var view = me.getView();
load: function(callback) {
var me = this;
var view = me.getView();
+ var store = view.getStore();
if (view.emailSelection) {
if (!me.lookupReference('email').getSelection()) {
// if the combobox has no selection we do not reload
if (view.emailSelection) {
if (!me.lookupReference('email').getSelection()) {
// if the combobox has no selection we do not reload
- view.getStore().load(callback);
+ store.load(function() {
+ if (me.savedPosition !== undefined) {
+ if (store.getCount() - 1 < me.savedPosition) {
+ me.savedPosition = store.getCount() - 1;
+ }
+ view.setSelection(store.getAt(me.savedPosition));
+ }
+ if (Ext.isFunction(callback)) {
+ callback();
+ }
+ });
},
setFrom: function(from) {
},
setFrom: function(from) {
this.lookupReference('email').queryCaching = true;
},
this.lookupReference('email').queryCaching = true;
},
+
+ savePosition: function(grid, selected, eopts) {
+ if (!selected.length) {
+ return;
+ }
+
+ var me = this;
+ var view = me.getView();
+
+ var id = view.getStore().indexOf(selected[0]);
+
+ me.savedPosition = id;
+ },
+
+
- beforedestroy: 'resetEmail'
+ beforedestroy: 'resetEmail',
+ selectionchange: 'savePosition'
},
'combobox[reference=email]': {
change: {
},
'combobox[reference=email]': {
change: {