Jump to content


Photo

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


  • Please log in to reply
5 replies to this topic

#1 delagoutte

delagoutte

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 296 posts

Posted 13 November 2017 - 03:57 PM

Hello,

See picture please

Attached File  multiselect.png   19.27KB   2 downloads

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 ?


  • 0

#2 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 13 November 2017 - 06:58 PM

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,


  • 0

#3 delagoutte

delagoutte

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 296 posts

Posted 14 November 2017 - 08:15 AM

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.c...g-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


  • 0

#4 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 14 November 2017 - 08:39 AM

Ok, I will check
  • 0

#5 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 14 November 2017 - 10:46 AM

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
    }
}

  • 0

#6 delagoutte

delagoutte

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 296 posts

Posted 14 November 2017 - 11:06 AM

Thanks 

it is working


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users