Results 1 to 3 of 3

Thread: [SOLVED] Cosmetic problem for get index ID of selected row

  1. #1
    Sencha User vaucer's Avatar
    Join Date
    Aug 2009
    Location
    Paris
    Posts
    50

    Default [SOLVED] Cosmetic problem for get index ID of selected row

    Hello,

    I encounter a problem for retrieve the focus on my grid after reload.

    I founded on the forum this solution for hold the position of my scroll:

    Code:
    Ext.override(Ext.grid.GridView, {
        holdPosition: false,
        onLoad : function(){
            if (!this.holdPosition) this.scrollToTop();
            this.holdPosition = false
        }
    });
    
    Grid.getView().holdPosition = true;
    But i would like to set the focus on my selected row.

    I tried many solutions on this forum but i don't found.

    I believe im able to get the id of my row like this, but it's never the good row selected:

    Code:
    Grid.focus();
    sR = Grid.getSelectionModel().getSelected();
    Grid.getSelectionModel().selectRow(parseInt(sR.id);
    Grid.getView().focusRow(parseInt(sR.id));
    thx you very much for your help.

    Vaucer
    Last edited by vaucer; 8 Apr 2010 at 10:48 AM. Reason: Issue solved

  2. #2
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676

    Default

    getSelected() returns a record. Did you ever debugged the record?
    For selection you need the row index, not the id of the record.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  3. #3
    Sencha User vaucer's Avatar
    Join Date
    Aug 2009
    Location
    Paris
    Posts
    50

    Default override rowselectionmodel

    First thx you for you answer.

    Finally i used this solution:

    Code:
    Ext.grid.RowSelectionModel.override ({
        getSelectedIndex : function(){
            return this.grid.store.indexOf( this.selections.itemAt(0) );
        }
    });
    then:
    Code:
    Grid.getSelectionModel().getSelectedIndex();
    It's solved.

    Vaucer

Posting Permissions

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