A example of using the datagrid API functions

As well as this you can ispect the page andd see the hidden input value changing as you select and deselect rows.