1. #1
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    867
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default Focus Tree Row

    Focus Tree Row


    Hi.

    Imagine I have just added a new node to a certain parent in my tree.
    No imagine I want the viewer to focus on the row where the new node was added.

    Right now, I'm doing it like this:
    PHP Code:
    treeGrid.getView().focusRow(treeGrid.getView().findRowIndex(treeGrid.getView().getRow(model))); 
    Is there an easier way of accomplish this?

    Thanks,
    Michel.

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Code:
    treeGrid.getView().focusRow(treeGrid.getStore().indexOf(model)));

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    867
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default


    Tks Sven.

    I was trying that with the wrong store... indexOf of the TreeListStore was returning the index inside the parent only...
    but getStore() returns the listStore... which is the right one to use for this.

    Regards,
    Michel.

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    285
    Vote Rating
    48
    Ekambos is a jewel in the rough Ekambos is a jewel in the rough Ekambos is a jewel in the rough

      0  

    Default


    You guys realize that such a call :
    Code:
    treeGrid.getView().focusRow(treeGrid.getView().findRowIndex(treeGrid.getView().getRow(model)));
    is really bad from the OO Design standpoint

    if the grid is supposed the setfocus on a row

    why not add a method like
    Code:
    treeGrid.focusRow(rowIndex);
    and let the grid handle all that stuff ?

    with the actual implementation the caller needs to know too much stuff about the grid.

    cheers

    Alain

Similar Threads

  1. How to set focus to a tree programatically?
    By florian.trossbach in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 17 Jun 2010, 2:26 AM
  2. Set focus on a tree node
    By clavinovahan in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 27 May 2010, 7:05 AM
  3. Replies: 3
    Last Post: 9 Apr 2009, 6:01 AM
  4. Two Ext.tree's: Change focus onmouseover? (1.0a3 IE7)
    By oxi in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 10 Mar 2007, 9:29 AM

Thread Participants: 2

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