1 Reply Latest reply on Aug 1, 2008 9:39 AM by Newsgroup_User

    Pre-selecting a datagrid row

    pbk-nFjYI4
      I have two datagrids. When the user selects a row in datagrid 1 (which lists sales regions), I refresh datagrid 2 (which lists sales people in the selected sales region). Then I want the first row in datagrid 2 to be selected automatically.

      I use "dgSalesmen.selectedIndex = 0;" in an attempt to preselect the row. The problem appears to be that, although this line of code is after the line that refreshes the data in grid 2, the preselection does not wait for the data to be refreshed. The result is that no row is selected.

      Is there a way to delay execution of this line of code until datagrid 2 has finished updating?

      Thanks. Pete
        • 1. Re: Pre-selecting a datagrid row
          Level 7

          "pbk" <webforumsuser@macromedia.com> wrote in message
          news:g6v7qj$53$1@forums.macromedia.com...
          >I have two datagrids. When the user selects a row in datagrid 1 (which
          >lists
          > sales regions), I refresh datagrid 2 (which lists sales people in the
          > selected
          > sales region). Then I want the first row in datagrid 2 to be selected
          > automatically.
          >
          > I use "dgSalesmen.selectedIndex = 0;" in an attempt to preselect the row.
          > The
          > problem appears to be that, although this line of code is after the line
          > that
          > refreshes the data in grid 2, the preselection does not wait for the data
          > to be
          > refreshed. The result is that no row is selected.
          >
          > Is there a way to delay execution of this line of code until datagrid 2
          > has
          > finished updating?

          Add an updateComplete event listener, then do it there.

          HTH;

          Amy