1 Reply Latest reply on Aug 15, 2011 5:17 PM by Don Kerr

    Datagrid bound to datagrid item at startup

    Code Girl Level 1

      I have a datagrid with contact info.   Each record is a contact.  I also have a second datagrid

      with a list of records by contact.  Once the app is running and I select a contact, the second grid populates as I like.  However, at startup, at creation complete I told the first grid to set the selected index to 0.  However, the second grid is not populated.  Until I click a different contact.  Whats the trick to getting the second grid to populate with the first grids index 0 contact at startup?

        • 1. Re: Datagrid bound to datagrid item at startup
          Don Kerr Level 3

          Sounds like it might be a timing issue.  Without seeing your code, I'm making some assumptions.

           

          Instead of using creationComplete in the contact grid,  wait until your contact data is finished loading from the server before you set the selectedIndex=0. 

           

          For example, if you were using a remoteObject call, add the selectedIndex=0 in the remoteObject's result handler.

           

          The data has to be finished loading before you can get a contactsGrid.selectedItem.  creationComplete is only for the creation of the grid itself, not its dataProvider.

           

          Hope this helps.

          Don