Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Setting list grid message for unauthorized fetch

    Hey,

    I'm using: SmartClient_v83p_2013-02-24.

    I have a List Grid which uses generic data provider. In the data provider class I create DSResponse that contain the relevant data. Sometimes the user is unauthorized to view the data so I return an empty DSResponse, that cause the List Grid to display "No items to show" message. I would like to have the opportunity to display another message in case the user is unauthorized to view the data.

    I was thinking about setting specific status code in the server DSResponse and catch the returned client DSResponse in the ResultSet.transformData and than check what is the status code and change the message accordingly, but this sound to me a bit workaroundy. Can you direct me to a better solution (or what is the best approach will be)?

    Thank you.

    #2
    Signal an error from the server and the default error handling will show a warning dialog to the user (see the Error Handling overview for how to customize this).

    This is better than messing with the emptyMessage since there's no reason to clear validly cached data, and since your current approach invalidly tells the grid that the fetch executed successfully but simply returned zero rows, which will create an issue if the user further refines the criteria (the grid will, correctly, believe that it can continue to show zero rows for any criteria that is more restrictive).

    Comment


      #3
      I used dsResponse.setFailure and I do see a message about the report. Now let's say that I have to replace the empty message to unauthorized. How should I do it?

      Thanks

      Comment


        #4
        setEmptyMessage() + redraw() should do it, however just to reiterate: we wouldn't recommend clearing existing, successfully fetched rows if it's possible for a user to be in such a state when the authorization failure happens.

        Comment


          #5
          The user can't view the whole report not just specific rows so we would have this problem.

          I understand that I can use the setEmptyMessage but my question is when? what is the function I need to use in order to catch the DSResponse with the error code?

          Comment


            #6
            Sounds like you still haven't read the Error Handling overview previously mentioned.

            Not if you are trying to indicate to the user that an entire report is inaccessible (and the report consists of more than a grid), then here again, we would not recommend using the emptyMessage of the grid. Use something like a modal dialog instead.

            Comment


              #7
              I uploaded an example that elaborate the problem.

              Please notice that the user can see three reports in one page.

              The first one is unauthorized
              The second one is authorized with data
              The third one is authorized without data

              I want that the user will see any indication on the report that it's unauthorized.
              Attached Files

              Comment


                #8
                So once again,

                Note if you are trying to indicate to the user that an entire report is inaccessible (and the report consists of more than a grid), then here again, we would not recommend using the emptyMessage of the grid. Use something like a modal dialog instead.

                Comment


                  #9
                  The problem is that the when the user close the modal dialog he won't have any indication that the report is unauthorized.

                  Anyway, I understand that you don't recommend empty message so I will think about something else.

                  Thank you.

                  Comment

                  Working...
                  X