From 8f22791e9df015f2efb6d929c412db190cd1de30 Mon Sep 17 00:00:00 2001 From: Vincent Fiduccia Date: Tue, 13 Aug 2019 15:00:36 -0700 Subject: [PATCH] Support disabling rows --- .../addon/components/sortable-table/component.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/shared/addon/components/sortable-table/component.js b/lib/shared/addon/components/sortable-table/component.js index cd0150e67..1024fc7bf 100644 --- a/lib/shared/addon/components/sortable-table/component.js +++ b/lib/shared/addon/components/sortable-table/component.js @@ -18,7 +18,7 @@ function toggleInput(node, on) { if ( id ) { let input = $(`input[nodeid="${id}"]`); // eslint-disable-line - if ( input && input.length ) { + if ( input && input.length && !input[0].disabled ) { // can't reuse the input ref here because the table has rerenderd and the ref is no longer good $(`input[nodeid="${id}"]`).prop('checked', on); // eslint-disable-line @@ -557,13 +557,11 @@ export default Component.extend(Sortable, StickyHeader, { if ( value ) { this.toggleMulti(content, []); - - return true; } else { this.toggleMulti([], content); - - return false; } + + return get(this, 'selectedNodes.length') === get(this, 'pagedContent.length'); } }), @@ -613,8 +611,9 @@ export default Component.extend(Sortable, StickyHeader, { } let nodeId = tgtRow.find('input[type="checkbox"]').attr('nodeid'); + let check = tgtRow.find('input[type="checkbox"]')[0]; - if ( !nodeId ) { + if ( !nodeId || !check || check.disabled ) { return; }