1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    10
    Vote Rating
    0
    Redsandro is on a distinguished road

      0  

    Question simpleSelect on xtype:grid with selModel: RowSelectionModel -> Possible?

    simpleSelect on xtype:grid with selModel: RowSelectionModel -> Possible?


    I have a grid with an implied default selModel of RowSelectionModel, and implied default setting singleSelect = false, causing you to be able to select multiple rows of data.

    In a gridView, the same would be done using multiSelect = true, which also gives you the optional feature called simpleSelect = true. This makes it so you aren't required to hold ctrl for a multi-selection.

    Is there an easy way to have simpleSelect for a grid with RowSelectionModel? It's not in the documentation, but I was hoping there is a relatively simple trick to enable this. I'd reckon this is a popular feature and I'm probably missing something, but I can't figure it out using google.

  2. #2
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    I don't know of anything simple but here's something that seems to work:

    Code:
    new Ext.grid.GridPanel({
        ...
        listeners: {
            rowmousedown: function(grid, rowIndex, ev) {
                var selModel = grid.getSelectionModel();
    
                if (ev.button !== 0 || selModel.isLocked()){
                    return;
                }
    
                if (selModel.isSelected(rowIndex)) {
                    selModel.deselectRow(rowIndex);
                }
                else {
                    selModel.selectRow(rowIndex, true);
                }
    
                return false;
            }
        }
    });

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    10
    Vote Rating
    0
    Redsandro is on a distinguished road

      0  

    Thumbs up


    Thank you good Sir! This does pretty much exactly the trick.

    I didn't know rowmousedown was a proper event. I did try to look up all available events; the API documentation is awesome, but I have not yet succeeded in securing a list of available events.

    I hope this simple extension will be available in ExtJS 4. Haven't yet migrated to 4 because I figured migrating existing ExtJS 3 code is more work than just keep using 3. For now.

  4. #4
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    That event is definitely documented:

    http://dev.sencha.com/deploy/ext-3.4...grid.GridPanel

    Scroll right down to the bottom... third row up.

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    10
    Vote Rating
    0
    Redsandro is on a distinguished road

      0  

    Default


    You are right. My bad.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar