josebalius / ngReactGrid

A really fast Angular grid using the power of React to render. Based on ng-grid and jQuery DataTables.
http://josebalius.github.io/ngReactGrid/
MIT License
328 stars 47 forks source link

checkbox API #55

Closed ewu02 closed 9 years ago

ewu02 commented 9 years ago

Some refactoring and cleaning up

ngReactGridCheckbox API to set header and row checkbox values. Option to target checkboxes in rows with specified field value.

Example:

var checkboxGrid = 
  new ngReactGridCheckbox($scope.selections, 
      {batchToggle: true,
       disableCheckboxField: 'disableCheckbox'});

/* After pushing into grid.columnDefs */

// de-selects checkbox in header when batchToggle is enabled
checkboxGrid.setHeaderCheckboxState(false)

// Selects all non-disabled checkbox in active table page. Updates bound selectionTarget object
checkboxGrid.setVisibleCheckboxState(true); 

// Selects only checkbox in rows whose 'user.firstName' in grid.data value is 'Jose1'
checkboxGrid.setVisibleCheckboxState(true, {targetCheckboxes: {key: 'user.firstName', value: 'Jose1'}}); 
josebalius commented 9 years ago

@ewu02 awesome job! Anyway you can also submit a PR modifying the github pages to show off this example in the checkbox example?

ewu02 commented 9 years ago

Sure. Do you mean utilizing the API to select/deselect subset of the table page rows (with non-disabled checkboxes)? In examples/basic.html, there is an example for toggling all non-disabled, visible checkboxes via a button.