Announcement

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

    How to show prompt during ListGrid.saveAllEdits()

    I have a standard header/detail type of screen where the header information is in a set of forms using a ValuesManager and the details are in a ListGrid with setAutoSaveEdits(false). When the user clicks a Save button I first call ValuesManager.saveData() and in the callback to that, if it was successful, I call ListGrid.saveAllEdits() to save the details.

    On the call to ValuesManager.saveData() I include a DSRequest parameter with setShowPrompt(true) and setPrompt() to a custom message. I want to update the prompt message before I call saveAllEdits() so that user knows what is happening. How can I cause a prompt to show while saveAllEdits() is in progress.

    I've tried using SC.showPrompt() but that only causes the original ValuesManager.saveData() prompt to disappear and my new prompt does not show up in it's place. I don't see any way to customize the queue of requests generated by ListGrid.saveAllEdits() so that they show a prompt.

    Do I need to use RPCManager.setShowPrompt() and RPCManager.setDefaultPrompt()? If so, how do I reset the RPCManager back to the defaults after the queue of requests is complete?

    #2
    There's also a DataSource-level showPrompt setting which you've presumably got set false right now - you could flip that to true, call saveAllEdits, the back to it's normal setting.

    Comment


      #3
      We haven't change the showPrompt attribute on the DataSource from it's default. Explicitly setting showPrompt(true) on the DataSource just prior to calling saveAllEdits() makes no difference. The prompt from the outer VM.saveData() disappears and the user is no longer blocked while the saveAllEdits() request is processing.

      Comment


        #4
        What is your setting for ListGrid.waitForSave? This determines in general whether saves are regarded as blocking operations, and hence whether a prompt is used.

        Comment


          #5
          Thanks. That takes care of the blocking, but how can I specify promptStyle dialog and custom prompt text? Once the initial save completes the list grid saves block with the spinning cursor but the prompt has gone away.

          Comment


            #6
            You should be seeing that these default all the way to rpcManager.promptStyle and rpcManager.defaultPrompt.

            Comment


              #7
              I see that, but there doesn't appear to be any way to specify the prompt for the RPCRequest used by saveAllEdits() or to specify those parameters on the queued DSRequests it generates.

              Is the only option changing the default RPCManager settings and the changing them back after the requests complete (both in the callBack and in an editFailedHandler in case one of the requests fail)?

              Comment


                #8
                That is awkward, and we'll look at adding additional params to saveAllEdits to make this easier. Another option is to startQueue yourself before calling saveAllEdits, and submit one extra operation before calling saveAllEdits. It's the first operation that determines the prompt behavior and text for the queue. The extra operation could be a one-row dummy fetch or some operationBinding you've configured as a no-op.

                Comment


                  #9
                  On reflection, a simpler approach is available now: setAddOperation and setUpdateOperation will allow you to specify operationBindings to use with automatically issued requests, and operationBindings support a requestProperties option, where you could specific prompt & promptStyle.

                  But we will also be adding a grid.saveRequestProperties that applies to all save operations initiated by the grid, so that you can customized this at a per-component level.

                  Comment


                    #10
                    grid.setSaveRequestProperties() is now present in our mainline code-base and will show up in the next nightly build.

                    Comment


                      #11
                      Thanks. That will be helpful in other use cases too. Trying to bundle everything into an Operation ID can get complicated.

                      Comment

                      Working...
                      X