Announcement

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

    [BUG] SelectItem._fetchMissingValueInProgress() doesn't work correctly on multiple

    Hi,
    fetchMissingValueReply -> _fetchMissingDisplayFieldValueReply -> _clearLoadingDisplayValue -> _fetchMissingValueInProgress(checkDisplayFieldValues, newValue):

    when there is selected multiple items in a SelectItem, newValue variable will contain an array, and code inside will always return true, and that's why our SelectItem fields is never set back to setCanEdit(true) after "Loading..."

    Code:
        _fetchMissingValueInProgress : function (checkDisplayFieldValues, newValue) {
    
            // Assertion - if we have the value in our _displayFieldValueMap, we've already
            // fetched and retrieved the display value
            var undef;
            if (newValue !== undef && checkDisplayFieldValues && this._displayFieldValueMap &&
                isc.propertyDefined(this._displayFieldValueMap, newValue))    /// <- isc.propertyDefined doesn't support  "newValue" to be an array so, we never call "return false;"
            {
                return false;
            }
    Code:
     
    _clearLoadingDisplayValue : function (notFoundCount) {
           //....
            var value = this.getValue();
            if (!this._fetchMissingValueInProgress(true, value)) {  // <- on multiple items we never entering into this block
                this.logDebug("clearLoadingDisplayValue() - " +
                              "no outstanding fetch for display value, so clearing loading marker",
                              "loadingDisplayValue");
                this._showingLoadingDisplayValue = false;
                if (this._readOnlyFetchMissingValue) {
                    delete this._readOnlyFetchMissingValue;
                    this.setCanEdit(this._explicitCanEdit);  
                }
    Currently fast fix, is to override "isc.propertyDefined" and add support to accept array in second argument.

    PS. Sorry, I'm really busy now, so cannot provide simple test case. Hope the description will be clear to understand a problem :)

    #2
    Hi, Isomorphic,
    found a little free time. Here is a proof of concept. Affected all versions.
    Effect: drop down doesn't work as item is now in canEdit:false state.

    Hope this helps :)

    Code:
    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <meta http-equiv="Cache-control" content="no-cache">
        <title></title>
    
        <script>var isomorphicDir = "smartclient/";</script>
        <script src=smartclient/system/modules-debug/ISC_Core.js></script>
        <script src=smartclient/system/modules-debug/ISC_Foundation.js></script>
        <script src=smartclient/system/modules-debug/ISC_Containers.js></script>
        <script src=smartclient/system/modules-debug/ISC_Grids.js></script>
        <script src=smartclient/system/modules-debug/ISC_Forms.js></script>
        <script src=smartclient/system/modules-debug/ISC_DataBinding.js></script>
        <script src=smartclient/skins/EnterpriseBlue/load_skin.js></script>
    
    </head>
    <body>
    <script>
        var ds = isc.DataSource.create({
            clientOnly: true,
            fields: [
                {name: 'id', type: 'integer'},
                {name: 'title', type: 'text'},
            ],
            testData: [
                {id: 1, title: 'One'},
                {id: 2, title: 'Two'},
                {id: 3, title: 'Three'},
                {id: 4, title: 'Four'}
            ],
            fetchData: function (criteria, callback, requestProperties) { // simulate 0.5s response delay
                var self = this;
                isc.Timer.setTimeout(function () {
                    self.performDSOperation("fetch", criteria, callback, requestProperties);
                }, 500);
            }
        });
    
    
        isc.DynamicForm.create({
            fields: [
                {
                    name: 'options',
                    optionDataSource: ds,
                    autoFetchData: true,
                    multiple: true,
                    editorType: 'SelectItem',
                    displayField: 'title',
                    valueField: 'id',
                    suppressOptionDSCacheAccess: true // DataSource is clientOnly so suppress this to emulate real datasource.
                }
            ],
            values: {
                options: [1, 3]
            }
        });
    </script>
    </body>
    </html>

    Comment


      #3
      Thanks for the test case. We made a change which should resolve this issue for you. This actually went in yesterday so should be present in the latest nightly build - June 15

      Regards
      Isomorphic Software

      Comment

      Working...
      X