PDA

View Full Version : A button that selects all rows of a grid without using a checkbox.



Mthor
5 Nov 2009, 8:58 AM
I have searched with no luck to find out of there is a way to have a button that selects all rows in a grid.

I currently use the GridRowChecker and have a button that selects all the rows. I have been asked to remove the checkboxes and have a sect all button to select all rows with one click so I can delete all records. I also have it set up where i can delete one row at a time. how can I select all rows in the grid with out using a checkbox?

thanks

uniring
5 Nov 2009, 9:42 AM
If you're using an Ext.grid.RowSelectionModel (http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.RowSelectionModel) you can use the selectAll() function of that component. You can get the RowSelectionModel object using the getSelectionModel() function of your grid (http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.GridPanel).



grid.getSelectionModel().selectAll();


Be sure that you doesn't have the singleSelect option enabled on your RowSelectionModel.

Mthor
5 Nov 2009, 10:24 AM
Awesome!! thanks I got that working. what is the call to deselect. I could not find in the api,

I got the select all button working. just need to get the deselect all. what is the opposite of selectAll();


I tried the un(); but it was a no go, or i installed it wrong



and thanks again for the help on the select all

uniring
5 Nov 2009, 10:26 AM
clearSelections


You have it in the api (http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.RowSelectionModel), try to search better! xD

Mthor
5 Nov 2009, 10:31 AM
you are correct i should of searched better.


thanks for the help, got it all working!!