Jump to content

Full cell click and not only checkbox for multiselect : possible ?


delagoutte

Recommended Posts

Hello,

See picture please

post-892-0-03187100-1510588345_thumb.png

i have a grid with multiselect : true.

 

On image there is row 1 and 2 that are selected.

if i click on checkbox (1 on image) i'll have row 1,2,3 that will be selected.

but

if i click nearby chekc box in cell (2 in image) i'll have only row 3 that will be selected.

 

how can ido for having the click on part 2 = click on part 1 -> if i click on 2 on image that i'll have row 1,2,3 selected ? is it possible ?

Link to comment
Share on other sites

Hello,

 

Maybe like this ?!:

 

UniDBGrid -> ... function beforeitemclick:

function beforeitemclick(sender, record, item, index, e, eOpts)
{
    
    var _selModel=sender.getSelectionModel();
    var _selected=_selModel.isSelected(record);
    
    if (!_selected) {
        _selModel.select(record, true);
    } else {
        _selModel.deselect(record, false);
    }
    return false;
}

Best regards,

Link to comment
Share on other sites

Hello, 

it is not that i want.

With this code, it is working but if click on an other cell in the row the row is selected (as if i have press Ctrl+Click)

if i click on an other cell row, the other rows must be unselected.

 

I was wondering if i could do it with this config :

http://docs.sencha.com/extjs/4.2.5/#!/api/Ext.selection.CheckboxModel-cfg-checkSelector

 

i try this 

function checkboxModel.beforeInit(sender, config)
{
  config.checkSelector = "x-grid-row-checker";
}

x-grid-row-checker is the default value but I don't know what other values to put

Link to comment
Share on other sites

Another solution,

Can you try to use this approach for now ?!:

 

1. function beforeitemclick

 

2. function beforecellclick:

function beforecellclick(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) 
{
    if (cellIndex == 0) {
        var _selModel = sender.getSelectionModel();
        var _selected = _selModel.isSelected(record);

        if (!_selected) {
            _selModel.select(record, true);
        } else {
            _selModel.deselect(record, false);
        }
        return false
    }
}
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...