1. #1
    Sencha User
    Join Date
    Apr 2007
    Posts
    70
    Vote Rating
    0
    rarerules is on a distinguished road

      0  

    Default Unanswered: Grid scroll to group headers

    Unanswered: Grid scroll to group headers


    I have a grouped grid with a lot of rows. I would like to add a button to the grid's toolbar which allows the user to automatically scroll to any of the grid's grouped headers. So if group A is visible, and group B is not, a button would automatically scroll the grid to the location of group B in the grid.

    I know of the view's focusRow() function, I just don't know how to use it in this context. Thanks!

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,910
    Answers
    655
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You should be able to use select to select the index of the 1st item in a group.

    Code:
    grid.getSelectionModel().select(2);
    You will need to determine the index.

    Scott.

  3. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,895
    Answers
    368
    Vote Rating
    176
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    See if this is kinda what you're looking for. Probably a little hacky, but seemed to work (did the focusRow twice since if the group is collapsed it expands the group, but does not focus the row and if it's expanded it focuses the row).

    Code:
    var store = Ext.create('Ext.data.Store', {
        storeId:'employeeStore',
        fields:['name', 'seniority', 'department'],
        groupField: 'department',
        data: {'employees':[
            { "name": "Michael Scott",  "seniority": 7, "department": "Management" },
            { "name": "Andy Bernard",  "seniority": 7, "department": "Management" },
            { "name": "Dwight Schrute", "seniority": 2, "department": "Sales" },
            { "name": "Jim Halpert",    "seniority": 3, "department": "Sales" },
            { "name": "Kevin Malone",   "seniority": 4, "department": "Accounting" },
            { "name": "Angela Martin",  "seniority": 5, "department": "Accounting" },
            { "name": "Oscar Martinez",  "seniority": 5, "department": "Accounting" }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'employees'
            }
        }
    });
    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Employees',
        store: Ext.data.StoreManager.lookup('employeeStore'),
        columns: [
            { text: 'Name',     dataIndex: 'name' },
            { text: 'Seniority', dataIndex: 'seniority' }
        ],
        features: [{ftype:'grouping'}],
        width: 200,
        height: 275,
        renderTo: Ext.getBody()
        , dockedItems: [{
            xtype: 'toolbar'
            , dock: 'top'
            , items: [{
                text: 'Sales'
                , handler: function (btn) {
                    var grid = btn.up('gridpanel');
                    grid.getView().focusRow(grid.store.findRecord(grid.store.groupField, btn.text));
                    grid.getView().focusRow(grid.store.findRecord(grid.store.groupField, btn.text));
                }
            }]
        }]
    });

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."