Announcement

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

    Problem with MultiComboBoxItem

    Hello Isomorphic,

    MultiComboBoxItem is showing javascript error when the DataSource is set to the DynamicForm. I am able to reproduce the issue in the example in Showcase. Please find the attached java example(MultiComboBoxSample.java).

    I am using Smartgwt - 5.0P (Version v10.0p_2019-09-22 (2019-09-22)) and Google Chrome - Version 77.0.3865.120 (Official Build) (64-bit)

    In my case, I have not set OptionDataSource to MultiComboBoxItem, but setting the DataSource to DynamicForm. When I am trying to select or enter a value second time , it is showing me the following Javascript Error .

    ISC_Core.js:1656 Uncaught TypeError: Cannot read property 'undefined' of null
    at _2.isc_MultiComboBoxItem_sortOrder [as sortOrder] (ISC_Forms.js:2217)
    at ISC_Forms.js:2226
    at Object.$96c (ISC_Core.js:482)
    at _2.isc_c_MultiComboBoxItem__binarySearch [as $96c] (ISC_Forms.js:2209)
    at _2.isc_MultiComboBoxItem__insertButtonForValue [as $96r] (ISC_Forms.js:2226)
    at _2.isc_MultiComboBoxItem__comboBoxItemChanged [as $96p] (ISC_Forms.js:2221)
    at _2.changed (ISC_Forms.js:2217)
    at _2.isc_FormItem_handleChanged [as handleChanged] (ISC_Forms.js:968)
    at _2.isc_c_Class_invokeSuper [as invokeSuper] (ISC_Core.js:258)
    at _2.isc_c_Class_Super [as Super] (ISC_Core.js:250)

    Please advice, how to resolve the issue.
    Thank you in advance for your support.

    Best Regards,
    Sonia
    Attached Files

    #2
    We'll fix this, but since you asked how to resolve the issue: just set the optionDataSource on the MultiComboBoxItem. Have the MultiComboBoxItem pick up the DataSource from the form is just a convenience.

    Comment


      #3
      Hello Isomorphic,

      Thanks for the quick response.

      We need a MultiComboBoxItem works without optionDataSource, as in our case, the values will be added by user at runtime and should be available as a comma separated String once user submit the form.

      So we are waiting for the fix.

      Thanks & Best Regards,
      Sonia

      Comment


        #4
        So again, the feature of automatically picking up the optionDataSource from the surrounding form's DataSource is just a convenience relative to setting the same DataSource via setOptionDataSource(). No matter how the DataSource is created or derived, or how the values are added, you can simply set the same DataSource via setOptionDataSource(), and that works. So this is not a blocking bug; it's just a convenience features that isn't working.

        Comment


          #5
          Hello Sonia
          Our development team has investigated this issue. The problem is specific to the 5.0p branch. It's already resolved in 5.1p [which you should have access to as part of your license] and all subsequent branches (6.x, 12.x).
          We will patch 5.0p to resolve this issue but it is worth noting that if you're doing new development we would strongly recommend updating to a more recent build. The ideal would be to jump to the current release build, but even shifting to 5.1p would bring you closer in line with the latest code base and ensure you have access to fixes (like this) that have already been made or backported to that branch.

          Regardless - we should have the fix for this issue installed in the 5.0p branch shortly, so please try the next nightly build dated Nov 9 or above

          Regards
          Isomorphic Software

          Comment


            #6
            Hello Isomorphic,

            I have tried the same example with 'SmartClient Version: v10.0p_2019-11-09/LGPL Development Only (built 2019-11-09)' but still have the same javascript Error.

            I have also tried the other suggestion by you - set the same DS to DynamicForm and as optionDataSource() to the MultiComboBoxItem

            No matter how the DataSource is created or derived, or how the values are added, you can simply set the same DataSource via setOptionDataSource(), and that works
            but have another issue, that a fetch request is being sent to the DataSource, once the user click on PickListIcon. This is not desirable in our case, as this DataSource has a special criteria for fetch to be fulfilled and also we don't want this extra overhead(fetch request) as the results return by DS doesn't make any sense for MultiComboBoxItem, as this DataSource is meant for the whole DynamicForm.

            What we really need to do, to have a MultiComboBoxItem without OptionDataSource() and any ValueMap?

            And The Values are specified by user input at runtime. When the form is submitted, the values should be part of the request.

            Thanks you in advance for your support.

            Best Regards,

            Sonia


            Comment


              #7
              Hi sonia_v,

              just guessing here, but perhaps a (empty at start) client side datasource?
              Fetch is still asynchronous, but does not leave the client and therefore has no overhead.

              Best regards
              Blama

              Comment


                #8
                We'll check on the fix not appearing in new 5.0 builds. You can make sure you have run a GWT compile and cleared browser cache, and then you can look at the actual build date of the files by inspecting the response from the server using standard browser tools.

                As far as the fetch from the downArrow click, that is standard functionality for comboBoxes, so we wouldn't recommend breaking it. Also, we're not sure what you mean about "without OptionDataSource() and any ValueMap?" as that would simply mean no values at all.

                You could the pickerIcon entirely, or you could provide a PickListCriteriaFunction via the comboBox autoChild that uses whatever criteria you want. Use the filterWithValue property to understand whether the fetch is coming from a pickerIcon click - it gets set to false in that circumstance to create normal expected behavior.

                Comment


                  #9
                  Hi Sonia
                  We're finding that the original sample works for us with the latest 5.0 build (dated November 9). If you're still seeing a problem, and the suggested steps to ensure you're not looking at stale code don't resolve things (clearing browser cache and forcing a GWT compile, etc), it's possible that we're misunderstanding what the problem is.

                  We're testing this by the following steps:

                  - open the modified sample
                  - use the drop down to select a value for the item ("Not Endangered", say)
                  - use the drop down to select an additional value for the item ("May Become Threatened", say)

                  At this stage in the older builds the bug would manifest. The second value would not be selected and we'd see a Javascript error.

                  This is no longer the case for us with the November 9th build.

                  Does this description match your steps to reproduce the issue, or are there additional steps?

                  Regards
                  Isomorphic Software

                  Comment


                    #10
                    Hello Isomorphic,

                    The scenario mentioned by you above works with the November 9th build.

                    But as I mentioned above, that we need a MultiComboBoxItem without any optionDataSource() and ValueMap() as the Input will be provided by user at runtime. So now after your fix it works without any optionDataSource , but with only those fields that have a ValueMap. So in case of your above mentioned testing steps - if you comment out the the following statement in AnimalXmlDS.java
                    Code:
                     
                     /* statusField.setValueMap("Threatened", "Endangered", "Not Endangered", "Not currently listed","May become threatened","Protected"); ​​​​​​​*/
                    It will show the same JavaScript Error.

                    Currently, I have a work around, by using a ValueMap with blank string and it works.

                    Code:
                    setValueMap("");
                    Hope this will be fixed. Please let me know, if the sample code for the case I mentioned is need to be provided.

                    Thank you for your support.

                    Best Regards,

                    Sonia

                    Comment


                      #11
                      If the end user is providing the values, that can be achieved with via optionDataSource (just add records) or via valueMaps (just call setValueMap). Configuring a comboBox with no source of values at all is invalid usage. Correct usage would be an empty valueMap, not a blank string.

                      Comment


                        #12
                        Hi Sonia
                        Just to follow up on this one more time - supplying an empty valueMap (an empty array) is indeed the right way to configure a MultiComboBox with no initial values, but we've also looked into why the JS error was occuring when you didn't do this.

                        It's actually due to a bug that only occurs when the MultiComboBoxItem has no specified valueMap or optionDataSource, but the DynamicForm in which the item occurs does derive its fields from a dataSource.

                        In this case the item should use the form's dataSource as an optionDataSource by default (this is documented under FormItem.getOptionDataSource()), rather than suppressing the list of options altogether. This is essentially a convenience feature so developers don't have to reiterate the dataSource explicitly as item.optionDataSource in the case when the same DS is being used in both cases, and the fact it's causing a JS error is clearly a bug.

                        We'll make a change to address this, but since it's a convenience method, quite a specific usage, and doesn't actually match what you're trying to achieve we won't be backporting this fix to any branches earlier than 12.0 for now.

                        Regards
                        Isomorphic Software

                        Comment

                        Working...
                        X