Announcement

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

    LISTGRID.REFRESHDATA

    I'm developing an entire application with client-side framework.
    My case is when I do "mygrid.refreshData()" does nothing.

    Follows specification of my develop practice:
    1.- Populate all object (dataSource, Grid, Tree, etc) by Restful (servlet)
    2.- That's mean, Im using async + await fetch.
    3.- Something I found is for all things works I've to add all objects in async functions. It maybe no necessary but the app is working so.
    4.- There are calls async functions subsequent.
    5.- I've defined clientOnly:true. I've treated to define false, but autoFetchData:true (in the grid control), change to true.
    6.- I've defined autoFetchData:false, then do myWind.show(), grid appears without records.
    7.- I've an append in the saveData event on a DynamicForm, no to the grid, directly to database by Restful.
    8.- After insert the record follow grid.refreshData and gives the follow error:

    *13:45:01.097:MUP1:WARN:Log:TypeError: _2 is undefined
    Stack from error.stack:
    Canvas.refreshData() @ js/isomorphic/system/modules%20deobf/Core.js:40552:22
    saveData() @ js/Components.js:281:26
    anonymous() @ js/isomorphic/system/modules%20deobf/Core.js line 734 > Function:3:27
    FormItem._fireStandardHandler() @ js/isomorphic/system/modules%20deobf/Forms.js:13795:24
    FormItem.handleClick() @ js/isomorphic/system/modules%20deobf/Forms.js:13813:23
    CanvasItem._createCanvas/_2.handleActivate() @ js/isomorphic/system/modules%20deobf/Forms.js:18042:55
    StatefulCanvas.handleClick() @ js/isomorphic/system/modules%20deobf/Foundation.js:1922:21
    Class.invokeSuper() @ js/isomorphic/system/modules%20deobf/Core.js:2614:27
    Class.Super() @ js/isomorphic/system/modules%20deobf/Core.js:2542:21
    CanvasItem._createCanvas/_2.handleClick() @ js/isomorphic/system/modules%20deobf/Forms.js:18034:27
    [c]EventHandler.bubbleEvent() @ js/isomorphic/system/modules%20deobf/Core.js:22030:34
    [c]EventHandler.handleClick() @ js/isomorphic/system/modules%20deobf/Core.js:20791:21
    EventHandler._handleMouseUp() @ js/isomorphic/system/modules%20deobf/Core.js:20633:37
    [c]EventHandler.handleMouseUp() @ js/isomorphic/system/modules%20deobf/Core.js:20568:21
    [c]EventHandler.dispatch() @ js/isomorphic/system/modules%20deobf/Core.js:22715:21
    anonymous() @ js/isomorphic/system/modules%20deobf/Core.js line 734 > Function:3:123
    EventHandlerNonNull*isc_c_EventHandler_captureEvent() @ js/isomorphic/system/modules%20deobf/Core.js:22742:13
    [c]EventHandler.captureEvents() @ js/isomorphic/system/modules%20deobf/Core.js:22795:14
    unnamed() @ js/isomorphic/system/modules%20deobf/Core.js:23707:22
    Core.js:12567:36
    13:45:01.097

    Remember, the error appears when I defined autoFetchData:false.
    If defined to true the error not appear.

    At the end, I do the refreshData in a standard function called by async function.

    The question is, is possible to do a refreshData with the version of client-side?

    Are there some parametrize that I've to do?

    My unique alternative is to do my own method to refresh grids?.
    (I think using async functions with Restful as I did everything)

    Well, I hope I have sent you everything necessary to understand my case.

    If more information is required, dont hesitate to request it.

    Hugs.

    #2
    It's difficult to tell, but it sounds like possibly you are trying to do a refreshData() on a grid which has never fetched data, which would be invalid - just call fetchData() instead. If that's the problem, please let us know, as we might as well handle this case automatically, even if the approach isn't right.

    Also, if you are using clientOnly DataSources throughout your app, you've unfortunately got your architecture wrong: clientOnly DataSources don't scale well, since they require all data to be loaded up front. Please revisit the QuickStart Guide, Data Integration chapter, to learn about RestDataSource and custom REST integrations.

    Comment


      #3
      "... you are trying to do a refreshData() on a grid which has never fetched data"
      It isn't so, I've commented, as to test, defined autoDraw:false, so the grid never did a fetch. Just as a test, after that changed to autoDraw:true
      When defined autoDraw:false, grid appears without records and did the grid.refreshData() throws errors.

      "... Also, if you are using clientOnly DataSources throughout your app"
      It maybe my mistake use clientOnly. I remember in some situation when I was developing, something throws an error related to this parameter, so I added it. Now I've commented all lines of this.

      "... DataSources don't scale well, since they require all data to be loaded up front. Please revisit the QuickStart Guide, Data Integration chapter, to learn about RestDataSource and custom REST integrations."
      Ok, understand, but now at this moment I've developed a lot of code to reformulate.

      When the grid fetches records, the clientOnly parameter is automatically set to true. And as I mentioned earlier, I removed all references to this parameter in my code.

      At the end, suppose the following scenario. I need to develop an app with a button and grid, of course include a datasource.
      Now this page show up with this button (with a refresh icon) and the grid.
      I want to press any times this button and the grid will be populated each time.
      Is it possible to do it with a classic datasource with dataURL aim to Restful services?... How to do it?

      Let me say, my understand is AJAX, XMLHttpRequest, is possible do it whenever and wherever so if do a refreshData, it will send a request (AJAX) using a dataSource whose dataURL is a Restful that response with JSON data.

      Then, the responsibility of not degrade the app with subsequent request is mine.

      I hope you understand my point. If you could consider it for future versions.

      Hugs!!
      Last edited by cavogadr; 1st Apr 2021, 02:33.

      Comment


        #4
        Sorry, this is not making much sense.

        If you want a button that fetches data, that's fetchData(). If data is already loaded and you want to refresh it, that's refreshData().

        It doesn't make sense to try to change the clientOnly setting on the fly and this is documented to not work.

        If any of the above APIs don't seem to be working, we need a minimal, standalone test case showing valid usage leading to an error, and we need to know what that error is... we can't do anything with "something throws an error related to this parameter", sorry, that's not useful.

        As far as your feature request, as far as we can tell, you are asking that the system works the way it already does.. again we would recommend revisiting the QuickStart Guide, Data Integration chapter, and follow the links to further information, particularly RestDataSource.

        Comment


          #5
          Ok,
          I’ve done refresh using my method.

          I did fetch to Restful services. It return a JSON Object and then set myGrid.setData(<<json data returned>>).

          My only doubt is how does the data source linked to the grid its data resides

          Any way, thank you!!!!!

          Comment


            #6
            Sorry, but that also is wrong, and won't scale, because you're not using data paging.

            You really, really need to read the QuickStart Guide, Data Integration chapter, which explains how to do everything correctly.

            If you don't read this information and continue to just make guesses, you will just change back and forth between different approaches which are wrong, and not make any progress.

            Comment


              #7
              Ok, I understand. I’ll do what you are suggesting me.
              Best regards

              Comment


                #8
                Hi,
                I'm trying to read about RestDatasource how you suggested me but the links are wrong. Goes to invalid page.
                I've suspect the links are invalid. Here are both:

                https://www.smartclient.com/smartcli...RestDataSource
                https://www.smartclient.com/smartcli...ataIntegration

                Is it possible they are not be up to date?.

                Brgds

                Comment


                  #9
                  It looks like you’ve got an old version of the QuickStart with some stale links to 11+ year old versions. We’ll update those so that they work anyway, in the meantime, just use any link to the SmartClient Reference:

                  https://www.smartclient.com/smartcli....docViewerHelp

                  .. and look up the terms (eg RestDataSource).

                  Comment


                    #10
                    Hi!!
                    The error persists. I tried to access from the document on your site and it gives the same error.

                    You have to modify the links in the original document.

                    Brgds.

                    Comment


                      #11
                      ?

                      The links in the document are being fixed. They do not affect your ability to use the link provided in this thread. Go ahead - use it.

                      Comment

                      Working...
                      X