Announcement

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

    autoNavigate on SplitPane

    (13.0-d20200910p)

    Hi, was playing around a bit with splitpane in the new beta and got some strange behaviour that we don't see in production. Turns out the "autoNavigate" property was set to true despite me not touching it.

    I checked in production, and there it seems like it is "null" as your Apidocs say, but seems to default to true in the beta? Is this on purpose?

    #2
    Yes, we have flipped this to true by default, and there's a specially marked backcompat release note about it.

    You can simply change the default back if you want to (changeDefaults()), however, we thought we had done a good job of designing the feature so that it wouldn't interfere with people's hand-coded navigation and binding logic, so, if you have the time, it would be great to understand how it adversely affected your app.

    Comment


      #3
      Sure no problem, this cost me quite some time.

      1. At first, i didn't know what on earth was going on. I have a setup where i have a grid with a detail view. I have listeners that show selected items in the grid in the form. The form has some special handling, related to nfc, maps etc, so i do stuff when an item is to be shown. I also do custom stuff when the form goes into and out of editmode, as well as when items are saved. All this is on the client, but now i suddenly saw that the form started to issue fetch requests to the server, for a reason i could not understand.

      I removed listeners, tried putting in logging in all sorts of methods etc. to no avail (for example, the editrecord method was never called on my form, so where were the fetches called from?). I went back and forth between production and dev to try and understand it. Finally, i took it out of the splitpane and it started working again.


      2. OK, so what happens is the above. I have a SelectionChangeListener on the grid that calls editRecord() on the form with the record that was clicked on the grid, but apparently it interferes with your handling.
      For some reason, you think that the form has to call fetchData with the id from the server every time an item is clicked on in the grid. This happens whether i have my listener added or not.

      I cannot fathom why, and as i mentioned, i tried putting in gwt logs in basically every dataloading method in the form, but i could not find any method called by you. I suppose i must have missed a place.


      3. As i mentioned, i have a couple of custom editors. I use "editorType" to determine which formItem i'm to create (which i do manually). For example "editorType=trafficlight".
      I create all my components myself (grid, form), but i get this strange error in the logs:

      *07:50:57.254:XRP0:WARN:DynamicForm:isc_DefaultForm_0:Problem initializing item: {name: "flag", editorType: "trafficlight", type: "integer", title: "Tag", required: false, validators: Array[1], ruleScope: "isc_DefaultForm_0"} - derived FormItem class is: trafficlight. If this is not a typo, please make sure the relevant module is loaded. A SpacerItem will be created for this FormItem.
      This error is pretty hard to understand to me.
      EDIT: this was due to not setting datasource and fields at the same time. Apparently all the fields are created automatically, then discarded right away when i call setFields(). Nevermind.


      4. My usual tip: I think that if you're happy with this feature (by which i think you mean the automagic nature of the splitpane), i would suggest having examples and (better) documentation.
      There's nothing about how all this works in the SplitPane javadoc. There's some spread out in the different autoNavigate() and navigatePane()-methods, but how on earth are you supposed to find that? I haven't found any example in the showcase that details this feature either. As i have mentioned before, i think that you have huge room for improvement regarding documentation, onboarding and examples.


      5. Where is this backcompat release note? Happy for pointers so that i know where to look next time.
      Last edited by mathias; 22 Oct 2020, 06:23.

      Comment


        #4
        Originally posted by mathias View Post
        4. My usual tip: I think that if you're happy with this feature (by which i think you mean the automagic nature of the splitpane), i would suggest having examples and (better) documentation.
        There's nothing about how all this works in the SplitPane javadoc. There's some spread out in the different autoNavigate() and navigatePane()-methods, but how on earth are you supposed to find that? I haven't found any example in the showcase that details this feature either.
        +1

        Comment


          #5
          SplitPane.autoNavigate is there in the JavaDoc, and the docs directly address your one issue: a fetch was performed on the form since apparently there was a relation between the DataSources of the grid and form.

          Since the autoNavigate feature is now on by default, we will go ahead and link it from the SplitPane main JavaDoc - good suggestion. The new section looks like this:
          Auto-navigation

          By default, SplitPane will analyze the controls placed in each pane and the DataSources they are bound to, and automatically navigate between panes.

          For example, in a two-pane SplitPane with a ListGrid in the navigationPane and a DynamicForm in the detailPane, both with the same DataSource, when a record is selected in the grid, +link{dynamicForm.editRecord()} will be called to populate the form.

          In a 3-pane SplitPane with a TreeGrid and ListGrid in the navigationPane and listPane respectively, if there is a 1-to-Many relation from the TreeGrid's DataSource to the ListGrid's DataSource, +link{listGrid.fetchRelatedData()} will be used to load related records when tree nodes are clicked.

          For a full description of auto-navigation, see +link{splitPane.autoNavigate}. Just set <code>autoNavigate</code> to false if you don't want these behaviors.
          As far as a sample, one is coming (please remember you're looking at a development build), however, there's not much to show. It will be exactly the same as the existing SplitPane sample, with the two event handlers removed.

          It looks like you've already figured out that your second problem wasn't SplitPane-related: good. Yes, if you call setDataSource(), then do something that forces FormItems to be created (like drawing the form, or fetching), the automatic fields will be created, then thrown away if you later call setFields(). There's really no other way this could work, so yes, provide the DataSource and fields at the same time or you will create duplicate work.

          Overall, we understand that you're upset that you just wasted some time exploring a nightly build, but the we're a bit surprised by the broad critique of the docs. The volume of documentation and samples we provide greatly exceeds that of any other framework, and via Maven and other approaches, we have simplified setup as far as it will go (GWT itself still creates an irreducible minimum number of steps, of course). Given this, we can't do much with a suggestion that there's "huge room for improvement", however, we are always responsive to a user pointing out any specific problem area.



          Comment


            #6
            On your complaint #2, where autoNavigate attempted to load data into a form by calling fetchData() where your own code was calling editRecord(): can you confirm that two different DataSources were installed on the form vs the grid? And that there was an FK relation declared between those DataSources? That seems to be the only way a fetchData() call would have been issued (if the DataSources were the same, editRecord() would have been used, per docs).

            And if so, what were you up to with such a declaration? The only way we can see that this would make sense is if you used a special DS for the grid just to show a subset of fields, but that can be far more easily accomplished by just listGrid.fields and/or operationBinding.outputs. And if you used separate DataSources you would be creating extra work for yourself in other ways too (eg cache sync).

            So, we're a bit baffled how you got autoNavigate to misbehave; part of the reason we decided to turn it on by default is because it seemed that even if you had your own similar logic, the autoNavigate logic would be a harmless no-op.
            Last edited by Isomorphic; 22 Oct 2020, 22:40.

            Comment


              #7
              Just realized we missed telling you where the release notes are! There is a top-level file in SmartGWT packages that just points to this public interface for viewing and search release notes:

              https://www.smartclient.com/changes/...T&version=13.0

              Note the checkbox for viewing just notes having to do with Backwards Compatibility.

              Comment


                #8
                Regarding your question - no it was/is the same datasource in the grid and form. I'm pretty sure since the same server-side service is called both when the grid loads, and when the form tries to fetch the individual record, with the ID of the row that is selected in the grid. Also, it started working as soon as i turned off autoNavigate as i mentioned. (Finally, in the code, i do DataSource.get() in my Controller in one place and pass that in to the grid and form.)


                Thanks for the pointer to the doc. Let me just mention that i'm a smartGWT customer. There's no mention of this page in the documentation, nor in Your "FAQ" page for SmartGWT. It is not mentioned in the Quickstart PDF. In your "documentation" section on smartclient.com, it can see now that it's listed under "SmartClient", under "Beyond the Quick Start Guide", but not anywhere in the SmartGWT section.
                Last edited by mathias; 28 Oct 2020, 06:26.

                Comment


                  #9
                  It would be great to see a test case for that if you get a chance. That looks impossible given the way the code is arranged.

                  The changelog for both products is in the same place, just change the URL to SmartGWT (which is basically changing filter criteria to show/hide changes that are product-specific).

                  https://www.smartclient.com/changes/...T&version=12.1

                  We'll get that link on the documentation page, it was supposed to be there.

                  Comment


                    #10
                    A fix for the unexpected fetch if the "list' and "detail" panes have the same DS has been applied to SGWT 12.1 and newer branches, as of the nightly builds dated 2020-10-30. (For SGWT 12.1p, splitPane.autoNavigate is false by default, so you'd need to set it true to see the issue in your situation.)

                    Comment

                    Working...
                    X