RefetchCurrentRow
 

RefetchCurrentRow

3 posts, 1 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    21 Jan 2019
    Link to this post
    I am assuming this does not get called when the user clicks the update button (TableIOUpdate) on the toolbar. If I wanted to call this every time the user clicks update where is the best place to put this? Right now, I have it in the ToolClick event but I am sure there is a much better place to do this. I was thinking in the SmartViewer OnFieldEnabled before SUPER.
  2. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    Answered
    22 Jan 2019 in reply to Roger Blanchard
    Link to this post
    We don't call this method by ourselves. So you'll have to implement that at suitable place yourself. 

    FieldsEnabled should be o.k.. You should just not call it from there for creates.
  3. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    22 Jan 2019 in reply to Mike Fechner
    Link to this post
    Thanks Mike, I have added the following code to the OspreyViewer. It works great and can be enabled by a property on the viewer.

    thanks.

    METHOD OVERRIDE PROTECTED VOID OnBeforeEnableFields( INPUT e AS Consultingwerk.CancelableEventArgs ):
      
      DEFINE VARIABLE oAdapter AS SmartBusinessEntityAdapter  NO-UNDO.
      
      IF VALID-OBJECT (THIS-OBJECT:SmartDataSource) AND THIS-OBJECT:RefetchCurrentRowOnUpdate THEN
      DO ON ERROR UNDO, THROW:
       
       oAdapter = CAST (THIS-OBJECT:SmartDataSource, SmartBusinessEntityAdapter).
       
       IF VALID-OBJECT (oAdapter) AND NOT oAdapter:IsRowUncommittedAdd() THEN
        oAdapter:RefetchCurrentRow().
      
       CATCH eError AS Progress.Lang.Error:
        LogManagerWrapper:WriteError(eError).
       END CATCH. 
      END.
      
      SUPER:OnBeforeEnableFields(INPUT e).
     END METHOD.
3 posts, 1 answered