0 Replies Latest reply on Mar 6, 2009 6:20 AM by samau123

    Datagrid help

      I am trying to setup a simple graniteDS + Seam+ flex using the example on graniteDS site.
      I setup a simple booklist mxml as with the instruction. The problem I am having is that whenever I delete a row the datagrid would still remember the last item so (selecteditem!=null) even if there is no item highlighed.
      I am still able to dispatch the edit/delete event even the entity is already detached from the last delete.

      Seems like datagrid should return the selecteditem to null after deleting a binded dataprovider. (I refreshed the dataprovider inside the event handler after the delete.) Is this a Flex sdk bug? or is there a way to manually refresh the datagrid to the proper state after an item is deleted.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      initialize="tideContext.tutorialApp = this;">

      import org.granite.tide.events.TideUIEvent;
      import org.granite.tide.seam.Seam;
      import org.granite.tide.seam.Context;
      import org.granite.tide.seam.framework.PagedQuery;
      import org.flexseam.Ctl.BooksCtl;
      public var tideContext:Context = Seam.getInstance().getSeamContext();

      Seam.getInstance().addComponent("bookList", PagedQuery);

      [Bindable] [In]
      public var bookList:PagedQuery;


      <mx:Panel label="Book list">
      <mx:DataGrid id="dgBooks" dataProvider="{bookList}"
      doubleClickEnabled="true" doubleClick="dispatchEvent(new TideUIEvent('editBook', dgBooks.selectedItem));">
      <mx:DataGridColumn headerText="Id" dataField="id"/>
      <mx:DataGridColumn headerText="Title" dataField="title"/>
      <mx:DataGridColumn headerText="Description" dataField="description"/>

      <mx:Button id="bCreate" label="Create book"
      click="dispatchEvent(new TideUIEvent('createBook'));"/>
      <mx:Button id="bEdit" label="Edit book"
      click="dispatchEvent(new TideUIEvent('editBook', dgBooks.selectedItem));"
      enabled="{dgBooks.selectedItem != null}"/>
      <mx:Button id="bDelete" label="Delete book"
      click="dispatchEvent(new TideUIEvent('deleteBook', dgBooks.selectedItem));"
      enabled="{dgBooks.selectedItem != null}"/>