Announcement

Collapse
No announcement yet.

Issue with Refreshing Detail View

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue with Refreshing Detail View

    Hello,

    We are currently encountering a challenge in our project where we need to refresh the complete detail view for the Contact entity.

    In our project, we have implemented custom ACL (Access Control Logic). All users have access to view all contacts, but some users, based on certain criteria, can only view (not edit) certain fields. These restricted fields are filtered out using OutputFilter on the backend and hidden in the frontend within the record/detail.js file using the hideField function.

    When a user is unable to edit the entity due to restrictions, an "Unlock" button appears. Clicking this button adds the user to the unlockedByUsers field, which grants them access to view and edit all fields of that entity.

    The issue arises after pressing the "Unlock" button — we need to refresh the entire view. On the backend, after the unlock action occurs, we attempt to refresh on the frontend with the following code:

    PHP Code:
    this.model.fetch();
    this.reRender(); 
    However, this approach does not fully refresh the view; the hidden fields remain hidden (even though they are correctly fetched in the model), and the edit mode is not enabled as expected.

    We attempted to manually manage this logic using showField, but this approach is not working.

    Currently, our workaround is to use location.reload();, but we are eager to implement a more appropriate solution.

    Could someone please assist us with potential solutions?

  • #2
    Couldn`t you achieve this by conditional logic on field level in the admin GUI?

    Comment


    • #3
      Did you add an event handler to this.model to listen to changes and hide/show field depending on conditions. If not, consider this approach. No need to call reRender then.

      Comment


      • #4
        Originally posted by tomasrotek View Post
        Hello,

        We are currently encountering a challenge in our project where we need to refresh the complete detail view for the Contact entity.

        In our project, we have implemented custom ACL (Access Control Logic). All users have access to view all contacts, but some users, based on certain criteria, can only view (not edit) certain fields. These restricted fields are filtered out using OutputFilter on the backend and hidden in the frontend within the record/detail.js file using the hideField function.

        When a user is unable to edit the entity due to restrictions, an "Unlock" button appears. Clicking this button adds the user to the unlockedByUsers field, which grants them access to view and edit all fields of that entity.

        The issue arises after pressing the "Unlock" button — we need to refresh the entire view. On the backend, after the unlock action occurs, we attempt to refresh on the frontend with the following code:

        PHP Code:
        this.model.fetch();
        this.reRender(); 
        However, this approach does not fully refresh the view; the hidden fields remain hidden (even though they are correctly fetched in the model), and the edit mode is not enabled as expected.

        We attempted to manually manage this logic using showField, but this approach is not working.

        Currently, our workaround is to use location.reload();, but we are eager to implement a more appropriate solution.

        Could someone please assist us with potential solutions?
        if you manage how to hide/show fields in a method you can listen to an event listener using listen to change and call the method it will make fields visible and hide others based on conditions. This is what i always tend to use instead of calling this.Rerender()
        Rabii
        Web Dev

        Comment

        Working...
        X