Skip to content

Commit

Permalink
Update modx.window.resource.js
Browse files Browse the repository at this point in the history
Fix template picker component listeners to avoid errors in certain scenarios
  • Loading branch information
Jim Graham committed Feb 26, 2023
1 parent e7607a2 commit 6861ed9
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions manager/assets/modext/widgets/resource/modx.window.resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,21 @@ Ext.extend(MODx.combo.TemplatePicker, Ext.Panel, {
columns: 1,
items: items,
listeners: {
'render': {
fn: function(tf) {
var value = tf.getValue();

if (value.record) {
this.fireEvent('select', value.record);
render: {
fn: function(cmp) {
const value = cmp.getValue(),
record = value?.record
;
if (record) {
this.fireEvent('select', record);
}
},
scope: this
},
'change': {
fn: function(tf) {
var value = tf.getValue();

if (value.record) {
this.fireEvent('select', value.record);
change: {
fn: function(cmp, checked) {
if (checked.record) {
this.fireEvent('select', checked.record);
}
},
scope: this
Expand Down

0 comments on commit 6861ed9

Please sign in to comment.