CGridView multiple selection

Is there a way to get same multi-selection functionality with CGridview as Google Drive interface? Clicking a row always selects only one item and clicking on checkboxes selects multiple items. I would say that’s a reasonable default functionality but it seems it’s not possible.

I tried all selectableRows combinations to no avail. Closest i could get is with setting selectableRows of CGridview to null and selectableRows of CCheckBoxColumn to >1 but then I get stuck with "Checking a checkbox has nothing to do with selecting the row".

What is your need?

To be able to select more rows and that the checkboxes are connected to the row selection?

If that is the case… than on CGridView set the selectableRows to 2 and do not set anything on the CChecBoxColumn.

What you are suggesting reduces checkboxes to a visual clue only. It also enforces multiple selection, meaning user experience is reduced as they need to manually deselect items.

I would like to click on row and select 1 item and click on checkboxes to select multiple but still have checkboxes connected to row selection.

I really did not understood what you mean with reduced experience…

If you set it as I suggested… the checkbox click and the row selection are connected… you can click on any number of checkboxes and the rows are selected too… if you click on the row… then the checkboxes are clicked too…

Reduced experience - users sometimes need multiple selection not always. That means they expect single selection way of working - selecting items deselects previously selected items.

Suggested way basically makes checkboxes useless except for the check/uncheck all in the header.

If I understood you right you would like that the row selecton is in single row mode… and at the same time checkbox selection in multiple selection mode… and that the checkboxes are connected to row selection…

IMO that is a bit counterintuitive… what if someone wants just the opposite… how would the users know which one is in effect…

Then again if you think that the checkboxes are useless in this situation, probably because of the thinking why use a checkbox when you can click anywhere on the row… then why not have them separated from row selection… if they are separated then you can do what you need…

row selection can be in single row mode… and checkbox selection can be in multiple mode…

Can you not just register a script along the lines of:

var $gridView = $('#cGridViewID');

$gridView.find('tr').on( 'click', function( event ) {

    $gridView.find('input:checkbox').prop( 'checked', false );

    $(this).find('input:checkbox').prop( 'checked', true );


and, leave the checkboxes as their usual function.

You should also note that your example of google drive includes ctrl-click to also provide multi-select.

I guess Google makes counterintuitive interfaces then. If the sole function of checkboxes is row selection, I do not want to separate them from row selection. :)

I can’t think of a situation where you’d need a row selected and some other rows checked. It just confuses the user.

Thanks d3lirial, I tried that script with a few adjustments but just can’t get it right. I wouldn’t bother with ctrl+click, partly because I don’t know how and partly because half of the users can’t find ctrl and other half use a tablet/smartphone.

Sorry Dart,

I overlooked it a little bit… it should be more like:

var $gridView = $('#user-table');

$gridView.find('td:not(.checkbox-column)').on( 'click', function( event ) {

    $gridView.find('input:checkbox').prop( 'checked', false );

    $(this).parent().find('input:checkbox').prop( 'checked', true );


You can see it working on jsFiddle