|
1920 | 1920 | e.stopImmediatePropagation()
|
1921 | 1921 |
|
1922 | 1922 | const $this = $(e.currentTarget)
|
1923 |
| - const checked = $this.prop('checked') |
1924 |
| - const row = this.data[$this.data('index')] |
1925 |
| - |
1926 |
| - if ($(e.currentTarget).is(':radio') || this.options.singleSelect) { |
1927 |
| - for (let r of this.options.data) { |
1928 |
| - r[this.header.stateField] = false |
1929 |
| - } |
1930 |
| - this.$selectItem.filter(':checked').not($this).prop('checked', false) |
1931 |
| - } |
1932 |
| - |
1933 |
| - row[this.header.stateField] = checked |
1934 |
| - |
1935 |
| - this.updateSelected() |
1936 |
| - this.trigger(checked ? 'check' : 'uncheck', row, $this) |
| 1923 | + this.check_($this.prop('checked'), $this.data('index')) |
1937 | 1924 | })
|
1938 | 1925 |
|
1939 | 1926 | this.header.events.forEach((events, i) => {
|
|
2813 | 2800 | }
|
2814 | 2801 |
|
2815 | 2802 | check_ (checked, index) {
|
2816 |
| - const $el = this.$selectItem.filter(Utils.sprintf('[data-index="%s"]', index)).prop('checked', checked) |
2817 |
| - this.data[index][this.header.stateField] = checked |
| 2803 | + const $el = this.$selectItem.filter(`[data-index="${index}"]`) |
| 2804 | + const row = this.data[index] |
| 2805 | + |
| 2806 | + if ($el.is(':radio') || this.options.singleSelect) { |
| 2807 | + for (let r of this.options.data) { |
| 2808 | + r[this.header.stateField] = false |
| 2809 | + } |
| 2810 | + this.$selectItem.filter(':checked').not($this).prop('checked', false) |
| 2811 | + } |
| 2812 | + |
| 2813 | + row[this.header.stateField] = checked |
| 2814 | + $el.prop('checked', checked) |
2818 | 2815 | this.updateSelected()
|
2819 | 2816 | this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el)
|
2820 | 2817 | }
|
|
0 commit comments