Author Topic: Disable multiple row selection  (Read 3066 times)

raffoschi

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 15
    • View Profile
Disable multiple row selection
« on: March 16, 2016, 04:24:18 pm »
Hi,

if I use

Code: [Select]
selectionModel:{
    type: 'row',
    mode: 'single'
}

multiple record selection is still active using shift + left click.
Is it possible to disable it completely?

Thanks

Full code:
Code: [Select]
       $(function () {
        var data = [
            { rank: 1, company: 'Exxon Mobil', revenues: '339,938.0', profits: '36,130.0' },
            { rank: 2, company: 'Wal-Mart Stores', revenues: '315,654.0', profits: '11,231.0' },
            { rank: 3, company: 'Royal Dutch Shell', revenues: '306,731.0', profits: '25,311.0' },
            { rank: 4, company: 'BP', revenues: '267,600.0', profits: '22,341.0' },
            { rank: 5, company: 'General Motors', revenues: '192,604.0', profits: '-10,567.0' },
            { rank: 6, company: 'Chevron', revenues: '189,481.0', profits: '14,099.0' },
        ];

        var obj = {
            scrollModel: { autoFit: true },
            height: 400,
            editable: false,
            title: "No selections",
            minWidth: 30,
            colModel:
            [
                { title: "Rank", width: 100, dataType: "integer", dataIndx: "rank" },
                { title: "Company", width: 240, dataType: "string", dataIndx: "company" },
                { title: "Revenues ($ millions)", width: 180, dataType: "float", align: "right", dataIndx: "revenues" },
                { title: "Profits ($ millions)", width: 180, dataType: "float", align: "right", dataIndx: "profits" }
            ],
            dataModel: {
                data: data,
                location: "local",
                sorting: "local",
                sortIndx: "profits",
                sortDir: "down"
            },
            selectionModel:{
              type: 'row',
              mode: 'single'
            }
        }

        var $grid = $("#grid_rowhover").pqGrid(obj);

    });


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Disable multiple row selection
« Reply #1 on: March 16, 2016, 05:02:16 pm »
Please use this to disable it upon shift key:

Code: [Select]
cellMouseDown: function(evt){
if(this.option('selectionModel.mode') == 'single' && evt.originalEvent.shiftKey){
return false;
}
}

raffoschi

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Disable multiple row selection
« Reply #2 on: March 16, 2016, 05:43:57 pm »
Done and all right.

Thank you