Announcement

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

    Impossible to getValues() and save a form including a treeGrid

    Hi!

    I have a complex HMI to build, containing a treeGrid in a dynamicForm (through a layout and a CanvasItem).
    I managed to build my items, and to fill the form fields and the treeGrid with the data retrieved from my form datasource. But when I try to save the form, it fails. It is impossible to get the values of my form through form.getValues(), and any call to this method ends into a stack overflow.
    Have you ever deal with this kind of issue?
    Have you any tip to help my to deal with it or to find any solution to this issue?

    Some details:
    SmartGWT-5.0p
    Local treeGrid of child type

    #2
    Thanks to debugging, I found that there seems to be a "_parent" attribute on every child element in the tree, referencing its parent folder, and that can be the reason of the overflow (loop).

    In this forum, I found a post about a similar loop problem that should be resolved since 03/24 nigthly build. Waiting for any suggestion from your part, and even if my problem is not exactly the same, I will try to download the latest nightly build (because my version is older tant 03/24) and check if it also corrects my issue.
    Hello, I have a problem with a grouped ListGrid and a TreeGrid which have the same DataSource. The example temp_9906_1461071854768_1 When I add a new record

    Comment


      #3
      Go ahead and try the latest patched build and let us know if you still have a problem (always do this first).

      Comment


        #4
        I tried with the 06/24/16 nightly build and I still encounter the same problem : the BaseWidget.getAttributeAsMap(String property) fails when trying to convertToMap().

        Comment


          #5
          OK, since we show the only known issue with saving with records involved in a TreeGrid has already been resolved, what we need to look further is a minimal, ready-to-run test case demonstrating the issue you're encountering.

          Comment


            #6
            I've tried but up to now, I'm not able to reproduice the issue with a minimal test case :(

            But during my tests, when debugging in BaseWidget.getAttributeAsMap(String property), I noticed some differences between minimal and original test cases. Here is what I get during minimal test case.
            Click image for larger version

Name:	Capture.PNG
Views:	57
Size:	37.0 KB
ID:	238883


            During my test with original data, I do not have any "__ref" attribute. Can this be the reason of the loop issue? And if yes, do you have an idea of why this does not exist on my complex data? What did I do wrong?
            Attached Files
            Last edited by MelieZxy; 28 Jun 2016, 07:59.

            Comment


              #7
              No, the __ref attribute should not be an issue. Sorry, but there's nothing in your data that's unusual.

              Overall, what happens is that Tree-related attributes in the data, which obviously create loops (parent pointer + children array for example) are normally automatically ignored during any kind of recursive operation. It's hard to speculate how your application code manages to circumvent this - all we can say is look closely at whether all the APIs you are calling are actually documented, because calling undocumented APIs would definitely be a way to break things.

              Comment


                #8
                OK, I'll try to solve my issue on my own.
                But, I only use dynamicForm.getValues() or getValuesAsRecord() and saveData(). So I guess I'm not using any undocumented API.
                And today, I made a desperate try : before calling getValuesAsRecord() and saveData(), get the form field corresponding to the tree data, browse it and force the _parent pointer to a new Record. And surprise : it works! So, I'm convinced the problem comes from this pointer. But I cannot understand why I'm not able to reproduice the issue on a minimal test case...
                I think I'll keep this way to be able to save my data even if it is not very clean and hoping this won't have side effects.

                Comment

                Working...
                X