1. #1
    Sencha User
    Join Date
    Aug 2009
    Posts
    96
    Vote Rating
    1
    r4nd7263 is on a distinguished road

      0  

    Default Find and focus on a row in TreeGrid

    Find and focus on a row in TreeGrid


    Given a TreeModel, I want to focus on the row that represents the model in TreeGrid.

    Normally with regular Grid, I do

    Code:
    int index = grid.getStore().indexOf(m);
    grid.getView().focusRow(index);
    For TreeGrid, I changed to

    Code:
    int index = grid.getTreeStore().indexOf(m);
    grid.getTreeView().focusRow(index);
    But indexOf returns the index in parent, not the index in grid so the focus is off.

    How do I get the row index in grid? Or how do I get view to focus on a model?

  2. #2
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
    WesleyMoy is on a distinguished road

      0  

    Default


    What you're trying to do would be most easily handled by getting the ListStore (not the TreeGridStore) from the TreeGrid and using that to find the index of your model object. You can get the ListStore by calling getStore on TreeGrid. This lets you determine exactly what the row index of the item is using indexOf. At this point, you can focus the appropriate row.

    The reason you should be using the ListStore is that this store represents the rows that will actually be displayed, in the order they would be shown. Any nodes that have been hidden because of filtering or collapsed parent nodes will correctly not take up any space. (These nodes themselves are not in the store and will have an index of -1.)

    There are a few things to keep in mind if you take this approach. First, the Grid must already have finished rendering. Second, any operation you may be responding to (like expanding, drag and drop, etc.) could result in a change in the index of the item you're interested in.

Thread Participants: 1

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