SmartDataBrowser
 

SmartDataBrowser

6 posts, 1 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    22 Jan 2019
    Link to this post
    I am trying to delete the ActiveRow from the SmartDataBrowser but I do NOT want to delete from the DB. The use case for this is a user selects an order from the grid and attempts to update. Before we open the form used to update the record we call RefetchCurrentRow and then check the Order.Stat. If it has changed to a Stat where the user can no longer update we want to remove it from the grid and alert the user.

    I have used this in the past and it has worked just fine;

    THIS-OBJECT:PurchaseOrderBrowser:ActiveRow:Delete(FALSE).

    What is happening with the SmartDataBrowser is the LAST row in the grid is deleted NOT the ActiveRow. I have confirmed that the ActiveRow:Index is correct.

    I know I could just call RetrieveData in the BE Adapter as that would remove it for me but the user would be brought back to the top of the grid and they would need to scroll back to the position they were at.

    Should I be able to use the Row:Delete of the grid in this way? If not, is there a way to delete the TT record and row from the grid without deleting the record in the DB?
  2. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    22 Jan 2019 in reply to Roger Blanchard
    Link to this post
    The following will work. However, If there is a way to delete the record from the local TT/Grid without committing to DB that would be great.

    Thanks.

    /* Roger Blanchard / Osprey Retail Systems Jan 22, 2019
         The following seems to work;
          1. Get the Index from the current ActiveRow
          2. Call BE Adapter:RetrieveData which will now exclude the record we are on
          3. Call our UltraGridHelper:SetActiveGridRow
        */    
        
    iActiveRowIndex = THIS-OBJECT:PurchaseOrderBrowser:ActiveRow:Index.
    THIS-OBJECT:PurchaseOrderAdapter:RetrieveData().
    Osprey.Infragistics.Util.UltraGridHelper:SetActiveGridRow(THIS-OBJECT:PurchaseOrderBrowser, iActiveRowIndex).
  3. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    Answered
    22 Jan 2019 in reply to Roger Blanchard
    Link to this post
    If there is a way to delete the record from the local TT/Grid without committing to DB that would be great.


    Try to delete the record base on the smartBusinessEntityAdapter:BufferHandle and turn off the temp-table's TRACKING-CHANGES temporarily while doing that. Remember to turn it on (in a FINALLY block)
  4. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    22 Jan 2019 in reply to Mike Fechner
    Link to this post
    Thanks Mike...I will give that a try.
  5. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    23 Jan 2019 in reply to Mike Fechner
    Link to this post
    Hey Mike,

    When you say use the BusinessEntityAdapter:BufferHandle I assume you mean something like this. The code below needs to be cleaned up but it does appear to work.

    hDset = THIS-OBJECT:PurchaseOrderAdapter:DataSet.
    hBuffer = hDset:GET-BUFFER-HANDLE ("ePurchaseOrder").
    hQuery = hBuffer:QUERY.
      
    hBuffer:TABLE-HANDLE:TRACKING-CHANGES = FALSE.
    hBuffer:BUFFER-DELETE ().
    hQuery:DELETE-RESULT-LIST-ENTRY (). 
      
    THIS-OBJECT:PurchaseOrderBrowser:ActiveRow:Delete(FALSE).
      
    hBuffer:TABLE-HANDLE:TRACKING-CHANGES = TRUE.
  6. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    23 Jan 2019 in reply to Roger Blanchard
    Link to this post
    After testing I had to replace the ActiveRow:Delete with a call to the RefreshAll of the bindingsource. If I did not do that I would see query errors.

    // THIS-OBJECT:PurchaseOrderBrowser:ActiveRow:Delete(FALSE).
    THIS-OBJECT:PurchaseOrderBindingSource:RefreshAll().
6 posts, 1 answered