Fixes recordfinder (again)
Lots of complicated stuff going on here, all elements are getting wiped out when a record is updated and the control is getting disposed at the same time. We've created a dedicated variable to store the datalocker name as a string, this represents a small memory leak but a necessary one it seems. Fixes #2798
This commit is contained in:
parent
5daf4365ae
commit
982bc43348
|
|
@ -40,7 +40,7 @@
|
|||
RecordFinder.prototype.dispose = function() {
|
||||
this.$el.off('dblclick', this.proxy(this.onDoubleClick))
|
||||
this.$el.off('dispose-control', this.proxy(this.dispose))
|
||||
this.$el.removeData('oc.someDisposableControl')
|
||||
this.$el.removeData('oc.recordfinder')
|
||||
|
||||
this.$el = null
|
||||
|
||||
|
|
@ -62,15 +62,20 @@
|
|||
|
||||
RecordFinder.prototype.updateRecord = function(linkEl, recordId) {
|
||||
if (!this.options.dataLocker) return
|
||||
var $locker = $(this.options.dataLocker)
|
||||
|
||||
$locker.val(recordId)
|
||||
|
||||
// Selector name must be used because by the time success runs
|
||||
// - this.options will be disposed
|
||||
// - $locker element will be replaced
|
||||
var locker = this.options.dataLocker
|
||||
|
||||
$(locker).val(recordId)
|
||||
|
||||
this.$el.loadIndicator({ opaque: true })
|
||||
this.$el.request(this.options.refreshHandler, {
|
||||
success: function(data) {
|
||||
this.success(data)
|
||||
$locker.trigger('change')
|
||||
$(locker).trigger('change')
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue