Announcement

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

    Datasource updateCaches interferes with active pick list search

    I'm currently running on:
    SmartClient Version: v8.3p_2013-11-14/PowerEdition Deployment (built 2013-11-14)
    Browser: Chrome Version 35.0.1916.153 m

    Background:
    My application is setup to receive update cache events from the server over an asynchronous event channel. When an event is received, I will call update caches on the designated datasource.

    Issue:
    What we found is if you call updateCaches on a datasource that is currently associated with the optionDataSource on a SelectItem control, if a user is filtering on that select item when the event is received, the filter information they have entered in is cleared. In the case of an event flood, this issue can render the form completely unusable. Is this a known bug? Is there any way to prevent this from happening?

    I will attempt to govern the event floods to prevent this form making the system unusable, but if there is a way to prevent update caches from interfering with form controls, it would be the ideal.

    If you need sample code or additional information, please let me know. Any response would be greatly appreciated.

    Patrick

    #2
    PickList Properties

    I've tried the following properties on the pick list but neither of them seem to prevent updateCaches from clearing the control editor picklist.

    useClientFiltering: false,
    cachePickListResults: false

    To me, both settings would imply that smartclient is not using caching with the control and thus updateCaches should not effect them.

    Any thoughts?

    Comment


      #3
      Found the Cause

      I found the smartclient code causing my problem. In ISC_Forms.js there is the following block of code:
      Code:
       isc.A.updateValueMap = function isc_SelectItem_updateValueMap(_1) {
                  this.Super("updateValueMap", arguments);
                  if (this.$958)
                      return;
                  if (this.$192)
                      delete this.$192;
                  if (this.hasPickList()) {
                      if (this.pickList.isVisible() && this.pickList.isDrawn()) {
                          this.pickList.hide()
                      }
                      delete this.pickList.formItem
                  }
                  var _2 = this.getValue(), _3 = this.$190(_2);
                  if (_2 != _3) {
                      this.setValue(_3)
                  } else {
                      this.$952(this.getDisplayValue())
                  }
              }
      The call to this.pickList.hide() is clearing searches. Can we change this to check if the pickList is using cache before clearing here? I don't know the architecture well enough to understand the impact but I was thinking something like this....

      Code:
      isc.A.updateValueMap = function isc_SelectItem_updateValueMap(_1) {
                  this.Super("updateValueMap", arguments);
                  if (this.$958)
                      return;
                  if (this.$192)
                      delete this.$192;
                  if (this.hasPickList() && this.pickList.cachePickListResults) {
                      if (this.pickList.isVisible() && this.pickList.isDrawn()) {
                          this.pickList.hide()
                      }
                      delete this.pickList.formItem
                  }
                  var _2 = this.getValue(), _3 = this.$190(_2);
                  if (_2 != _3) {
                      this.setValue(_3)
                  } else {
                      this.$952(this.getDisplayValue())
                  }
              }

      Comment


        #4
        This is a plausible issue, but yeah we'll need a test case as we're not sure precisely what timing would be involved.

        One approach would be to use a dataProtocol:"clientCustom" DataSource - it's easy to use setTimeout to artificially delay responses so you can make an updateCaches() call in the middle.

        Comment


          #5
          Didn't see your updated post. Can you add code to log the result of Log.getStackTrace() so we can see the exact calling context? That may allow us to fix the problem without requiring a test case.

          Comment


            #6
            Code:
                
            [a]MathFunction.getStackTrace(_1=>undef, _2=>undef, _3=>undef, _4=>undef, _5=>undef)
                anonymous(source=>"with (__commandLineAPI || { __proto__: n..."[70], disable_break=>false, 
            opt_context_object=>undef)
                evaluate(expression=>"with (__commandLineAPI || { __proto__: n..."[70])
                anonymous(evalFunction=>evaluate(),  object=>[object JavaScriptCallFrame],  objectGroup=>"console",  expression=>"with (__commandLineAPI || { __proto__: n..."[70],  isEvalOnCallFrame=>true,  injectCommandLineAPI=>true,  scopeChain=>undef)
                anonymous(evalFunction=>evaluate(),  object=>[object JavaScriptCallFrame],  expression=>"Log.getStackTrace()",  objectGroup=>"console",  isEvalOnCallFrame=>true,  injectCommandLineAPI=>true,  returnByValue=>false,  generatePreview=>true,  scopeChain=>undef)
                anonymous(topCallFrame=>[object JavaScriptCallFrame],  asyncCallStacks=>Array[0],  callFrameId=>"{"ordinal":0,"injectedScriptId":3}",  expression=>"Log.getStackTrace()",  objectGroup=>"console",  injectCommandLineAPI=>true,  returnByValue=>false,  generatePreview=>true)
                SelectItem.updateValueMap(_1=>false)
                FormItem.updateDisplayValueMap(_1=>false)
                FormItem.dataSourceDataChanged(_1=>[DataSource ID:custom_list_default_com_ampm_medical_entity_MedicalPatient], _2=>Obj, _3=>Obj)
                dataChangedObservation(dsResponse=>Obj, dsRequest
            /**/=>Obj)
                DataSource.updateCaches(_1=>Obj, _2=>undef)
                callback(response=>Obj, new_data=>Array[1], request=>Obj)
                [c]Class.fireCallback(_1=>callback(), _2=>"rpcResponse,data,rpcRequest", _3=>Array[3], _4=>[RPCManager ID:builtinApplication], _5=>undef) on [Class RPCManager]
                [a]MathFunction.fireCallback(_1=>callback(), _2=>"rpcResponse,data,rpcRequest", _3=>Array[3], _4=>undef)
                [c]RPCManager.fireReplyCallback(_1=>callback(), _2=>Obj, _3=>Obj, _4=>Array[1])
                [c]RPCManager.fireReplyCallbacks(_1=>Obj, _2=>Obj)
                [c]RPCManager.performOperationReply(_1=>Obj, _2=>Obj)
                [c]RPCManager.$39d(_1=>50)
                [c]RPCManager.oldPerformTransactionReply(_1=>50, _2=>"//isc_RPCResponseStart-->[{status:0,data..."[3223], _3=>undef)
                [c]RPCManager.old_performTransactionReply(transactionNum=>50,  results=>Obj,  wd=>undef)
                anonymous(_a=>50,  _b=>[object XMLHttpRequest],  _c=>undef)
                callback(transactionNum=>50, results=>[object XMLHttpRequest], wd
            /**/=>undef)
                    "isc.RPCManager.performTransactionReply(transactionNum,results,wd)"
                ** recursed on [c]Class.fireCallback
            Last edited by patrickmann; 18 Jul 2014, 13:24.

            Comment


              #7
              I hacked the code change described above in my version of smartclient and it seems to have resolved the issue I'm having. I will have to do more testing to see if there are any negative side effects.

              Again, I don't know the architecture enough to know if this change is problematic. I look forward to your response.

              Comment


                #8
                So here is a way to simulate what I'm seeing using your feature explorer example for "List Multi-Field Search":

                Code:
                var pushEvent = function() {
                       var response = {
                         operationType: 'add',
                         data: [{itemId: counter, itemName: 'Item '+counter, SKU:''+counter, description: 'TestItem', category: 'Test', units: 'Pkt', unitCost: 1,   inStock: true }]
                       }
                       isc.DataSource.get("supplyItem").updateCaches(response);
                }
                
                var counter = 0;
                
                var testEvent = function() {
                       counter++;
                       pushEvent();
                       setInterval( testEvent, 4000 );
                }
                
                isc.DynamicForm.create({
                    ID:"testForm",
                    width: 500,
                    numCols:4,
                    fields : [
                    {
                        name: "filteredSelect", title: "Item (Select)", editorType: "SelectItem", 
                        optionDataSource: "supplyItem", 
                        displayField:"itemName", valueField:"SKU",
                        pickListWidth:300,
                        pickListProperties: {
                            showFilterEditor:true
                        },
                        pickListFields:[
                            {name:"SKU"},
                            {name:"itemName"}
                        ]
                    },
                    {
                        name: "filteredCombo", title: "Item (ComboBox)", editorType: "ComboBoxItem", 
                        addUnknownValues:false,
                        optionDataSource: "supplyItem", 
                        displayField:"itemName", valueField:"SKU",
                        filterFields:["SKU", "itemName"],
                        pickListWidth:300,
                        pickListFields:[
                            {name:"SKU"},
                            {name:"itemName"}
                        ]
                    }
                    ]
                });
                
                testEvent();

                Comment


                  #9
                  Update

                  I did some further testing and didn't find any adverse effects from removing the code that hides the pickList. For added measure, I removed the block of code entirely to test the behavior of the system (see code below). When I did this, the pickList updated properly whenever updateCaches is called without issue. I'm not sure why the block of code to hide the pickList is even necessary.

                  Code:
                  isc.A.updateValueMap = function isc_SelectItem_updateValueMap(_1) {
                              this.Super("updateValueMap", arguments);
                              if (this.$958)
                                  return;
                              if (this.$192)
                                  delete this.$192;
                  /*            if (this.hasPickList()) {
                                  if (this.pickList.isVisible() && this.pickList.isDrawn()) {
                                      this.pickList.hide()
                                  }
                                  delete this.pickList.formItem
                              }
                  */
                              var _2 = this.getValue(), _3 = this.$190(_2);
                              if (_2 != _3) {
                                  this.setValue(_3)
                              } else {
                                  this.$952(this.getDisplayValue())
                              }
                          }
                  Hopefully I've provided enough information for Isomorphic to determine if this code does more harm than good.

                  Patrick

                  Comment


                    #10
                    Hi Patrick,
                    We already have a change in place in the mainline development branch (10.0d) to address this issue - we intend to backport it to 9.1 and 8.3 in the near future - it's undergoing a little testing before we do so. Expect an update in the next few days

                    Regards
                    Isomorphic Software

                    Comment


                      #11
                      We've now ported this change back to 8.3 - Please try the next nightly build dated July 24 or above and let us know if the problem persists for you

                      Regards
                      Isomorphic Software

                      Comment

                      Working...
                      X