- Avoid error if something tries to refresh a destroy()ed nextmatch

- Fix not-cleared popup action
- Fix timing bug where nextmatch could display old data after an action
This commit is contained in:
Nathan Gray 2014-02-19 22:02:09 +00:00
parent 45303ecb15
commit bec852fed2
2 changed files with 8 additions and 6 deletions

View File

@ -428,7 +428,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
*/
refresh: function(_row_ids, _type) {
// Framework trying to refresh, but nextmatch not fully initialized
if(this.controller === null || !this.div.is(':visible'))
if(this.controller === null || !this.div || !this.div.is(':visible'))
{
return;
}

View File

@ -173,11 +173,6 @@ function nm_action(_action, _senders, _target, _ids)
return value;
}
if(_action.data.nm_action == 'open_popup')
{
// Force nextmatch to re-load affected rows
nextmatch.refresh(idsArr);
}
// downloads need a regular submit via POST (no Ajax)
if (_action.data.postSubmit)
@ -191,6 +186,12 @@ function nm_action(_action, _senders, _target, _ids)
if(_action.data.nm_action == 'open_popup')
{
// Force nextmatch to re-load affected rows
// Must be after submit, so server gives us up to date info
// Otherwise, old info will be sent and could overwrite the new,
// depending on timing.
nextmatch.refresh(idsArr);
// Reset action in case there's another one
nextmatch.getValue = old_value;
}
@ -325,6 +326,7 @@ function nm_open_popup(_action, _ids)
button.onclick.apply(button, e.currentTarget);
} : function(e) {
dialog.dialog("close");
nm_popup_action = null;
}
});
});