Announcement

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

    12.0p+: ComboBoxItem.getEnteredValue() broken in combination with pickListPlacement: "fillScreen"

    Hi Isomorphic,

    please see the debug log generated for text entry in the two ComboBoxItems in this modified sample (v12.1p_2022-06-24, FF 101 / Win10).
    As you can see, getEnteredValue() is broken in the 2nd item with pickListPlacement: "fillScreen".

    This is an example log output:
    Code:
    13:21:22.094:TMR4:WARN:Log:Value good item:test
    13:21:25.421:MUP8:WARN:Log:Value broken item:
    13:21:25.459:MUP8:WARN:Log:Value broken item:
    Best regards
    Blama

    Code:
    isc.VLayout.create({
        width: "100%",
        height: "100%",
        membersMargin: 30,
        members: [
            isc.DynamicForm.create({
                top: 25,
                titleWidth: 200,
                width: 600,
                numCols: 2,
                autoDraw: true,
                fields: [{
                        name: "categoryName",
                        title: "Category",
                        editorType: "SelectItem",
                        defaultToFirstOption: true,
                        valueMap: {
                            "Office Paper Products": "Office Paper Products",
                            "Exercise Books": "Exercise Books",
                            "Memo/Note Books": "Memo/Note Books",
                            "Wage/Time Books": "Wage/Time Books"
                        },
                        changed: "form.clearValue('itemName');"
                    },
                    {
                        name: "itemName",
                        title: "Normal ComboBoxItem (OK)",
                        editorType: "ComboBoxItem",
                        optionDataSource: "supplyItem",
                        displayField: "itemName",
                        valueField: "itemName",
                        addUnknownValues: false,
                        getPickListFilterCriteria: function() {
                            var category = this.form.getValue("categoryName");
                            var value = this.getEnteredValue();
                            isc.logWarn("Value good item:" + value);
                            if (value != null) {
                                return {
                                    _constructor: "AdvancedCriteria",
                                    operator: "and",
                                    criteria: [{
                                            fieldName: "category",
                                            operator: "equals",
                                            value: category
                                        },
                                        {
                                            fieldName: "itemName",
                                            operator: "iContains",
                                            value: value
                                        }
                                    ]
                                }
                            } else {
                                return {
                                    _constructor: "AdvancedCriteria",
                                    operator: "and",
                                    criteria: [{
                                        fieldName: "category",
                                        operator: "equals",
                                        value: category
                                    }]
                                };
                            }
                        }
                    },
                    {
                        name: "itemName2",
                        title: "Item with fillScreen and problem",
                        editorType: "ComboBoxItem",
                        pickListPlacement: "fillScreen", // causes the problem
                        optionDataSource: "supplyItem",
                        displayField: "itemName",
                        valueField: "itemName",
                        addUnknownValues: false,
                        getPickListFilterCriteria: function() {
                            var category = this.form.getValue("categoryName");
                            var value = this.getEnteredValue();
                            isc.logWarn("Value broken item:" + value);
                            if (value != null) {
                                return {
                                    _constructor: "AdvancedCriteria",
                                    operator: "and",
                                    criteria: [{
                                            fieldName: "category",
                                            operator: "equals",
                                            value: category
                                        },
                                        {
                                            fieldName: "itemName",
                                            operator: "iContains",
                                            value: value
                                        }
                                    ]
                                }
                            } else {
                                return {
                                    _constructor: "AdvancedCriteria",
                                    operator: "and",
                                    criteria: [{
                                        fieldName: "category",
                                        operator: "equals",
                                        value: category
                                    }]
                                };
                            }
                        }
                    }
                ]
            })
        ]
    });

    #2
    Hi Isomorphic,

    can you reproduce this error? It's still happening for me with the currently deployed (but old, there must be a build issue) v12.1p_2022-06-27 and also with the same sample code in v13.0p_2022-07-07.

    Best regards
    Blama

    Comment


      #3
      Hi Isomorphic,

      did you see this post? It's always hard to know when you don't post a "seen and reproduced / we are working on it / will work on it soon / we are discussing it / works as expected / can't reproduce".

      Thank you & Best regards
      Blama

      Comment


        #4
        Hi Blama
        Apologies for the long silence on this one [and please do bump threads that have been sitting a while]
        We see the problem and it's been assigned to a developer but we failed to keep you looped in.
        We'll follow up as soon as we have a resolution / more information for you

        Thanks
        Isomorphic Software

        Comment


          #5
          Hi
          The getEnteredValue() method retrieves the value of the text-field for a ComboBoxItem.
          When the pickListPlacement is set to fillScreen / fillPanel / halfScreen - typically the case for mobile interfaces - the ComboBoxItem doesn't show a standard editable text field - instead it has a separate search field in the navigation bar of the large pickList.

          This search field is a document autoChild, and is accessible via comboBoxItem.pickerSearchField:
          https://smartclient.com/smartclient-...kerSearchField
          this is embedded in the pickerSearchForm:
          https://smartclient.com/smartclient-...ckerSearchForm

          Therefore you can get what you need via a chunk of code like this:
          [code]
          myComboBoxItem.pickerSearchField.getEnteredValue()
          [code]

          ... or if you want code that will work in either view, you could first verify whether the pickerSearchForm is up:
          Code:
          var enteredValue;
          if (myComboBoxItem.pickerSearchForm && myComboBoxItem.pickerSearchForm.isVisible()) {
              enteredValue = myComboBoxItem.pickerSearchField.getEnteredValue();
          } else {
              enteredValue = myComboBoxItem.getEnteredValue();
          }
          This should give you a functional solution for your application.

          In the meantime we agree that this is not intuitive. We've made a change to 13.1 to make getEnteredValue() do essentially what we've described so it will retrieve the pickerSearchField value if appropriate. We intend to port this change back to 13.0, but will likely not be porting it back to earlier branches.

          Regards
          Isomorphic Software

          Comment


            #6
            Hi Isomorphic,

            thanks, I did not see those properties. While I agree that your suggested change makes sense, your workaround is more than fine for me in 12.1p.

            Thank you & Best regards
            Blama

            Working sample code:
            Code:
            isc.VLayout.create({
                width: "100%",
                height: "100%",
                membersMargin: 30,
                members: [
                    isc.DynamicForm.create({
                        top: 25,
                        titleWidth: 200,
                        width: 600,
                        numCols: 2,
                        autoDraw: true,
                        fields: [{
                                name: "categoryName",
                                title: "Category",
                                editorType: "SelectItem",
                                defaultToFirstOption: true,
                                valueMap: {
                                    "Office Paper Products": "Office Paper Products",
                                    "Exercise Books": "Exercise Books",
                                    "Memo/Note Books": "Memo/Note Books",
                                    "Wage/Time Books": "Wage/Time Books"
                                },
                                changed: "form.clearValue('itemName');"
                            },
                            {
                                name: "itemName",
                                title: "Normal ComboBoxItem",
                                editorType: "ComboBoxItem",
                                optionDataSource: "supplyItem",
                                displayField: "itemName",
                                valueField: "itemName",
                                addUnknownValues: false,
                                getPickListFilterCriteria: function() {
                                    var category = this.form.getValue("categoryName");
                                    var value = this.getEnteredValue();
                                    isc.logWarn("Value normal item:" + value);
                                    if (value != null) {
                                        return {
                                            _constructor: "AdvancedCriteria",
                                            operator: "and",
                                            criteria: [{
                                                    fieldName: "category",
                                                    operator: "equals",
                                                    value: category
                                                },
                                                {
                                                    fieldName: "itemName",
                                                    operator: "iContains",
                                                    value: value
                                                }
                                            ]
                                        }
                                    } else {
                                        return {
                                            _constructor: "AdvancedCriteria",
                                            operator: "and",
                                            criteria: [{
                                                fieldName: "category",
                                                operator: "equals",
                                                value: category
                                            }]
                                        };
                                    }
                                }
                            },
                            {
                                name: "itemName2",
                                title: "fillScreen ComboBoxItem",
                                editorType: "ComboBoxItem",
                                pickListPlacement: "fillScreen",
                                optionDataSource: "supplyItem",
                                displayField: "itemName",
                                valueField: "itemName",
                                addUnknownValues: false,
                                getPickListFilterCriteria: function() {
                                    var category = this.form.getValue("categoryName");
                                    var enteredValue;
                                    if (this.pickerSearchForm && this.pickerSearchForm.isVisible()) {
                                        enteredValue = this.pickerSearchField.getEnteredValue();
                                    } else {
                                        enteredValue = this.getEnteredValue();
                                    }
            
                                    isc.logWarn("Value fillScreen item:" + enteredValue);
                                    if (enteredValue != null) {
                                        return {
                                            _constructor: "AdvancedCriteria",
                                            operator: "and",
                                            criteria: [{
                                                    fieldName: "category",
                                                    operator: "equals",
                                                    value: category
                                                },
                                                {
                                                    fieldName: "itemName",
                                                    operator: "iContains",
                                                    value: enteredValue
                                                }
                                            ]
                                        }
                                    } else {
                                        return {
                                            _constructor: "AdvancedCriteria",
                                            operator: "and",
                                            criteria: [{
                                                fieldName: "category",
                                                operator: "equals",
                                                value: category
                                            }]
                                        };
                                    }
                                }
                            }
                        ]
                    })
                ]
            });

            Comment


              #7
              After some internal discussion we've decided to backport our change to 12.0 and above. Wherever possible we want to avoid forcing developers to write code that is device-aware, and this is a case where making "getEnteredValue()" just do the expected thing seems appropriate.
              (Your code will still work of course, but as of the next nightly build, so should your original version)

              Regards
              Isomorphic Software

              Comment


                #8
                Hi Isomorphic,

                it's like you say. Using v12.0p_2022-08-04 I can see that my code from #1 is now working as well.

                Thank you & Best regards
                Blama

                Comment

                Working...
                X