Handle row click as if checkbox was clicked, for checkable grid
should be more convenient since the checkbox is a rather small target as compared to the row itself. this also brings in newer Buefy 0.8.6 b/c it includes "shift+click" behavior for the checkbox: - https://github.com/buefy/buefy/issues/535 - https://github.com/buefy/buefy/pull/1894
This commit is contained in:
parent
abfe8bc648
commit
637c249c36
|
@ -143,6 +143,7 @@
|
||||||
:checkable="checkable"
|
:checkable="checkable"
|
||||||
% if grid.checkboxes:
|
% if grid.checkboxes:
|
||||||
:checked-rows.sync="checkedRows"
|
:checked-rows.sync="checkedRows"
|
||||||
|
@click="rowClick"
|
||||||
% endif
|
% endif
|
||||||
% if grid.check_handler:
|
% if grid.check_handler:
|
||||||
@check="${grid.check_handler}"
|
@check="${grid.check_handler}"
|
||||||
|
@ -446,6 +447,20 @@
|
||||||
}
|
}
|
||||||
return uuids
|
return uuids
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// when a user clicks a row, handle as if they clicked checkbox.
|
||||||
|
// note that this method is only used if table is "checkable"
|
||||||
|
rowClick(row) {
|
||||||
|
let i = this.checkedRows.indexOf(row)
|
||||||
|
if (i >= 0) {
|
||||||
|
this.checkedRows.splice(i, 1)
|
||||||
|
} else {
|
||||||
|
this.checkedRows.push(row)
|
||||||
|
}
|
||||||
|
% if grid.check_handler:
|
||||||
|
this.${grid.check_handler}(this.checkedRows, row)
|
||||||
|
% endif
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,9 +114,7 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="buefy()">
|
<%def name="buefy()">
|
||||||
## Buefy (last known good @ 0.8.2)
|
${h.javascript_link('https://unpkg.com/buefy@0.8.6/dist/buefy.min.js')}
|
||||||
## ${h.javascript_link('https://unpkg.com/buefy/dist/buefy.min.js')}
|
|
||||||
${h.javascript_link('https://unpkg.com/buefy@0.8.2/dist/buefy.min.js')}
|
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="fontawesome()">
|
<%def name="fontawesome()">
|
||||||
|
|
Loading…
Reference in a new issue