Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    programmatic select of listgrid record

    I have two databound listgrids that are related to one another by a foreignKey. I would like to be able to select the "one" record from the parent grid by clicking on one of the child records in the 2nd grid. In other words, when I click on a child record, I want the parent to be selected (I don't want to use a "fetch" because I want the entire list of parent records to still be showing.)

    I see in the javadoc how to use sele

    Any help on this would be appreciated.

    Thank you.

    #2
    Easiest way probably to do (*raw code*)
    Code:
    ListGridParent.selectRecord(ListGridParent.getRecordList().find("key", event.getRecord().getAttribute("foreignKey")));
    I'm assuming event is inside a click handler. Note also selection doesn't mean scrolling, so that might be an issue possibly depending on your needs.

    Comment


      #3
      Svjard
      That should work well, but you are a step ahead of me. I will ultimately need to "scroll" or somehow bring focus to the record to make sure the selected record is visible. Do you know how I might do that too?

      Thanks for your help.

      Comment


        #4
        Look into ListGrid.scollToRow() given you have fixed row heights

        Comment

        Working...
        X