Skip to content

Commit

Permalink
fixed early return
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes committed Sep 7, 2016
1 parent d0ca58a commit 1af2792
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 37 deletions.
40 changes: 22 additions & 18 deletions dist/husky.js
Original file line number Diff line number Diff line change
Expand Up @@ -32106,31 +32106,35 @@ define('husky_components/datagrid/decorators/table-view',[],function() {
* @param select {Boolean} true to select false to deselect
*/
toggleSelectRecord: function(id, select) {
if (!this.table.rows[id]) {
return;
}

if (select === true) {
this.datagrid.setItemSelected.call(this.datagrid, id);
// ensure that checkboxes are checked
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'checked', true
);
this.sandbox.dom.addClass(this.table.rows[id].$el, constants.selectedRowClass);
this.indeterminateSelectParents(id);

if (this.table.rows[id]) {
// ensure that checkboxes are checked
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'checked', true
);
this.sandbox.dom.addClass(this.table.rows[id].$el, constants.selectedRowClass);
this.indeterminateSelectParents(id);
}
} else {
this.datagrid.setItemUnselected.call(this.datagrid, id);
// ensure that checkboxes are unchecked
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'checked', false
);
if (this.table.rows[id].selectedChildren > 0) {

if (this.table.rows[id]) {
// ensure that checkboxes are unchecked
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'indeterminate', true
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'checked', false
);
if (this.table.rows[id].selectedChildren > 0) {
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el),
'indeterminate',
true
);
}
this.sandbox.dom.removeClass(this.table.rows[id].$el, constants.selectedRowClass);
this.indeterminateUnselectParents(id);
}
this.sandbox.dom.removeClass(this.table.rows[id].$el, constants.selectedRowClass);
this.indeterminateUnselectParents(id);
}

this.updateSelectAll();
Expand Down
2 changes: 1 addition & 1 deletion dist/husky.min.js

Large diffs are not rendered by default.

40 changes: 22 additions & 18 deletions husky_components/datagrid/decorators/table-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1478,31 +1478,35 @@ define(function() {
* @param select {Boolean} true to select false to deselect
*/
toggleSelectRecord: function(id, select) {
if (!this.table.rows[id]) {
return;
}

if (select === true) {
this.datagrid.setItemSelected.call(this.datagrid, id);
// ensure that checkboxes are checked
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'checked', true
);
this.sandbox.dom.addClass(this.table.rows[id].$el, constants.selectedRowClass);
this.indeterminateSelectParents(id);

if (this.table.rows[id]) {
// ensure that checkboxes are checked
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'checked', true
);
this.sandbox.dom.addClass(this.table.rows[id].$el, constants.selectedRowClass);
this.indeterminateSelectParents(id);
}
} else {
this.datagrid.setItemUnselected.call(this.datagrid, id);
// ensure that checkboxes are unchecked
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'checked', false
);
if (this.table.rows[id].selectedChildren > 0) {

if (this.table.rows[id]) {
// ensure that checkboxes are unchecked
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'indeterminate', true
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el), 'checked', false
);
if (this.table.rows[id].selectedChildren > 0) {
this.sandbox.dom.prop(
this.sandbox.dom.find('.' + constants.checkboxClass, this.table.rows[id].$el),
'indeterminate',
true
);
}
this.sandbox.dom.removeClass(this.table.rows[id].$el, constants.selectedRowClass);
this.indeterminateUnselectParents(id);
}
this.sandbox.dom.removeClass(this.table.rows[id].$el, constants.selectedRowClass);
this.indeterminateUnselectParents(id);
}

this.updateSelectAll();
Expand Down

0 comments on commit 1af2792

Please sign in to comment.