Skip to content

Commit c3e536a

Browse files
committed
grid.header.Button, table.header.Button: use onClick() directly #6652
1 parent 1b907d4 commit c3e536a

File tree

2 files changed

+12
-34
lines changed

2 files changed

+12
-34
lines changed

src/grid/header/Button.mjs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,7 @@ class Button extends BaseButton {
176176
let me = this,
177177
{cls} = me;
178178

179-
if (value) {
180-
NeoArray.remove(cls, 'neo-sort-hidden');
181-
182-
me.addDomListeners({
183-
click: me.onButtonClick,
184-
scope: me
185-
})
186-
} else {
187-
NeoArray.add(cls, 'neo-sort-hidden');
188-
189-
me.removeDomListeners({
190-
click: me.onButtonClick,
191-
scope: me
192-
})
193-
}
179+
NeoArray.toggle(cls, 'neo-sort-hidden', !value);
194180

195181
me.cls = cls;
196182
me.update()
@@ -215,9 +201,10 @@ class Button extends BaseButton {
215201
}
216202

217203
/**
204+
* @param {Object} data
218205
* @protected
219206
*/
220-
onButtonClick() {
207+
onClick(data) {
221208
let me = this,
222209
map;
223210

@@ -235,7 +222,9 @@ class Button extends BaseButton {
235222
}
236223
}
237224

238-
me.isSorted = map[me.isSorted + '']
225+
me.isSorted = map[me.isSorted + ''];
226+
227+
super.onClick(data)
239228
}
240229

241230
/**

src/table/header/Button.mjs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,7 @@ class Button extends BaseButton {
201201
let me = this,
202202
{cls} = me;
203203

204-
if (value === true) {
205-
NeoArray.remove(cls, 'neo-sort-hidden');
206-
207-
me.addDomListeners({
208-
click: me.onButtonClick,
209-
scope: me
210-
})
211-
} else {
212-
NeoArray.add(cls, 'neo-sort-hidden');
213-
214-
me.removeDomListeners({
215-
click: me.onButtonClick,
216-
scope: me
217-
})
218-
}
204+
NeoArray.toggle(cls, 'neo-sort-hidden', !value);
219205

220206
me.cls = cls;
221207
me.update()
@@ -354,9 +340,10 @@ class Button extends BaseButton {
354340
}
355341

356342
/**
343+
* @param {Object} data
357344
* @protected
358345
*/
359-
onButtonClick() {
346+
onClick(data) {
360347
let me = this,
361348
map;
362349

@@ -374,7 +361,9 @@ class Button extends BaseButton {
374361
}
375362
}
376363

377-
me.isSorted = map[me.isSorted + '']
364+
me.isSorted = map[me.isSorted + ''];
365+
366+
super.onClick(data)
378367
}
379368

380369
/**

0 commit comments

Comments
 (0)