Results 1 to 3 of 3

Thread: Grid with one row selected

  1. #1
    Sencha User
    Join Date
    Jan 2010
    Posts
    91
    Vote Rating
    0
      0  

    Default Grid with one row selected

    Hi,
    I need a grid with one row selected always. When i hit ctrl+click on a row selected, it gets "deselected".
    I need to block this behavior.

    Thanks

  2. #2
    Sencha User darthwes's Avatar
    Join Date
    Mar 2010
    Posts
    633
    Vote Rating
    -12
      0  

    Default

    hook select event.

    Your welcome.

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    133
      0  

    Default

    No, that won't work. Normally you would write a 'beforerowdeselect' event handler and return false if only one row was selected.

    Unfortunately, RowSelectionModel doesn't have a beforerowdeselect event, so you will need to do an inline override of deselectRow, e.g.
    Code:
    selModel: new Ext.data.RowSelectionModel({
      singleSelect: true,
      deselectRow: function(index) {
        if (this.selections.length == 1 && this.selections[0] == this.grid.store.getAt(index)) {
          return;
        }
        this.constructor.prototype.deselectRow.apply(this, arguments);
      }
    }
    }

Similar Threads

  1. Replies: 0
    Last Post: 29 Jun 2010, 12:17 PM
  2. grid and selected row
    By mnask79 in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 7 Oct 2009, 11:12 AM
  3. [SOLVED]Grid row highlight leaves row selected color
    By josh803316 in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 11 Mar 2009, 5:18 PM
  4. more than one row was selected in grid
    By michaelc in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 18 Mar 2008, 12:28 PM
  5. Replies: 2
    Last Post: 27 Dec 2007, 6:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •