Announcement

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

    #16
    The Showcase is special in a number of ways.. autoDraw:true issues are specially prevented.

    But you haven't explained in what environment you see duplicate calls. A standalone file (not the Showcase) would be the definitive way to check. And, that code in a standalone file (where autoDraw:true is the default!) would predictably produce duplicate formatValue calls, for the reasons we explained above.

    Comment


      #17
      I see the duplicate calls in the showcase.

      Comment


        #18
        Yes, again, the Showcase is special, so:

        Originally posted by Isomorphic View Post
        A standalone file (not the Showcase) would be the definitive way to check. And, that code in a standalone file (where autoDraw:true is the default!) would predictably produce duplicate formatValue calls, for the reasons we explained above.
        So, testing in a standalone file, you would need to correct the autoDraw issue - be sure to check the Developer Console!

        Comment


          #19
          Hi, I'm still not sure what exactly I should be looking for in the developer console, anyway I've set the log categories "draws", "redraws" and "redrawTrace" to debug level, and then I tried this test case:

          Code:
          isc.DynamicForm.create({
              ID: "testForm",
              dataSource: "JAS_ANAG_GIOCATORI_ALTRE_SQ",
              height: "100%",
              width: "100%", 
              items: [
                  {
                      name: "FOTO",
                      showFileInline: false,
                      editorType: "ViewFileItem",
                      displayItemProperties: {
                          formatValue: function (value, record, form, item) {
                              isc.logEcho(this.getStackTrace(), "formatValue")
                              return "foo";
                          }
                      },
                      canEdit: false
                  }
              ]
          }).show()
          I run it in my application, where isc.setAutoDraw(false) is set before creating any SmartClient widgets. The FOTO field is of type imageFile.

          This is what I see in the Developer Console, along with 5 calls to formatValue:

          15:23:32.197:WARN:Log:formatValue: "
          [a]StaticTextItem.formatValue(value=>undef, record=>Obj, form=>[DynamicForm ID:isc_DynamicForm_12], item=>[StaticTextItem ID:isc_StaticTextItem_20 name:FOTO])
          FormItem._formatDataType(value=>undef, asHTML=>undef, noLineBreaks=>undef)
          FormItem.mapValueToDisplay(value=>undef, recursed=>undef, includeValueIcons=>undef)
          FormItem._getDisplayValue(value=>undef, canUseCurrentValue=>undef)
          FormItem._showValue(newValue=>undef, resetCursor=>undef)
          FormItem.setValue(newValue=>undef, allowNullValue=>undef, timeCritical=>undef, dontResetCursor=>undef)
          FileItem.setValue(newValue=>undef, null)
          DynamicForm.setItemValues(values=>Obj, onRedraw=>null, initTime=>undef, items=>undef, validating=>undef)
          DynamicForm.setValues(newData=>Obj, initTime=>undef, skipRememberValues=>undef, skipRuleContextChange=>undef)
          DynamicForm.setData(newData=>Obj)
          EditorActionMethods._editRecord(record=>Obj)
          EditorActionMethods.editRecord(record=>Obj)
          "
          15:23:32.202:INFO:redraws:testForm:Scheduling redraw (1 children) (setValues)
          Canvas._logRedraw(reason=>"setValues", type=>undef)
          Canvas.markForRedraw(reason=>"setValues")
          DynamicForm.setValues(newData=>Obj, initTime=>undef, skipRememberValues=>undef, skipRuleContextChange=>undef)
          DynamicForm.setData(newData=>Obj)
          EditorActionMethods._editRecord(record=>Obj)
          EditorActionMethods.editRecord(record=>Obj)

          15:23:32.204:WARN:Log:formatValue: "
          [a]StaticTextItem.formatValue(value=>undef, record=>Obj, form=>[DynamicForm ID:isc_DynamicForm_12], item=>[StaticTextItem ID:isc_StaticTextItem_20 name:FOTO])
          FormItem._formatDataType(value=>undef, asHTML=>undef, noLineBreaks=>undef)
          FormItem.mapValueToDisplay(value=>undef, recursed=>undef, includeValueIcons=>undef)
          FormItem._getDisplayValue(value=>undef, canUseCurrentValue=>undef)
          FormItem._showValue(newValue=>undef, resetCursor=>undef)
          FormItem.setValue(newValue=>undef, allowNullValue=>undef, timeCritical=>undef, dontResetCursor=>undef)
          FormItem.clearValue()
          DynamicForm.setItemValues(values=>Obj, onRedraw=>null, initTime=>undef, items=>undef, validating=>undef)
          DynamicForm.setValues(newData=>Obj, initTime=>undef, skipRememberValues=>undef, skipRuleContextChange=>undef)
          DynamicForm.setData(newData=>Obj)
          EditorActionMethods._editRecord(record=>Obj)
          EditorActionMethods.editNewRecord(initialValues=>undef)
          ** recursed on EditorActionMethods._editRecord
          "
          15:23:32.205:INFO:redraws:isc_DynamicForm_12:Scheduling redraw (setValues)
          Canvas._logRedraw(reason=>"setValues", type=>undef)
          Canvas.markForRedraw(reason=>"setValues")
          DynamicForm.setValues(newData=>Obj, initTime=>undef, skipRememberValues=>undef, skipRuleContextChange=>undef)
          DynamicForm.setData(newData=>Obj)
          EditorActionMethods._editRecord(record=>Obj)
          EditorActionMethods.editNewRecord(initialValues=>undef)
          ** recursed on EditorActionMethods._editRecord

          15:23:32.218:TMR0:INFO:redraws:isc_DynamicForm_12:Immediate redraw of dirty widget (CanvasItem getting new size)
          Canvas._logRedraw(reason=>"CanvasItem getting new size", type=>false)
          Canvas.redraw(reason=>"CanvasItem getting new size")
          Class.invokeSuper(clazz=>null, methodName=>"redraw", a=>undef, b=>undef, c=>undef, d=>undef, e=>undef, f=>undef, g=>undef, h=>undef, i=>undef, j=>undef, lastArg=>undef)
          Class.Super(methodName=>"redraw", args=>[object Arguments], nativeArguments=>undef)
          DynamicForm.redraw("CanvasItem getting new size")
          Canvas.redrawIfDirty(reason=>"CanvasItem getting new size")
          CanvasItem.sizeCanvas(firstResizePass=>true)
          CanvasItem.checkCanvasOverflow()
          DynamicForm.getInnerHTML(printCallback=>completeInnerHTMLFun())
          Canvas._getInnerHTML(printCallback=>undef)
          Canvas._updateParentHTML(innerHTML=>undef)
          Canvas._updateHTML()
          ** recursed on Canvas.redraw

          15:23:32.221:TMR0:WARN:Log:formatValue: "
          [a]StaticTextItem.formatValue(value=>undef, record=>Obj, form=>[DynamicForm ID:isc_DynamicForm_12], item=>[StaticTextItem ID:isc_StaticTextItem_20 name:FOTO])
          FormItem._formatDataType(value=>undef, asHTML=>undef, noLineBreaks=>undef)
          FormItem.mapValueToDisplay(value=>undef, recursed=>undef, includeValueIcons=>undef)
          FormItem._getDisplayValue(value=>undef, canUseCurrentValue=>undef)
          FormItem._getTableHTML(value=>undef, includeHint=>true, includeErrors=>true)
          FormItem.getInnerHTML(value=>undef, includeHint=>true, includeErrors=>true, returnArray=>undef)
          anonymous(includedHtmlOutputs=>undef)
          DynamicForm.getInnerHTML(printCallback=>completeInnerHTMLFun())
          Canvas._getInnerHTML(printCallback=>undef)
          Canvas._updateInnerHTML()
          Canvas._updateHTML()
          Canvas.redraw(reason=>"CanvasItem getting new size")
          Class.invokeSuper(clazz=>null, methodName=>"redraw", a=>undef, b=>undef, c=>undef, d=>undef, e=>undef, f=>undef, g=>undef, h=>undef, i=>undef, j=>undef, lastArg=>undef)
          Class.Super(methodName=>"redraw", args=>[object Arguments], nativeArguments=>undef)
          DynamicForm.redraw("CanvasItem getting new size")
          Canvas.redrawIfDirty(reason=>"CanvasItem getting new size")
          CanvasItem.sizeCanvas(firstResizePass=>true)
          CanvasItem.checkCanvasOverflow()
          ** recursed on DynamicForm.getInnerHTML
          "
          15:23:32.224:TMR0:WARN:Log:formatValue: "
          [a]StaticTextItem.formatValue(value=>undef, record=>Obj, form=>[DynamicForm ID:isc_DynamicForm_12], item=>[StaticTextItem ID:isc_StaticTextItem_20 name:FOTO])
          FormItem._formatDataType(value=>undef, asHTML=>undef, noLineBreaks=>undef)
          FormItem.mapValueToDisplay(value=>undef, recursed=>undef, includeValueIcons=>undef)
          FormItem._getDisplayValue(value=>undef, canUseCurrentValue=>undef)
          FormItem._showValue(newValue=>undef, resetCursor=>undef)
          FormItem.setValue(newValue=>undef, allowNullValue=>undef, timeCritical=>undef, dontResetCursor=>undef)
          FormItem._showValueAfterDraw(redrawing=>true)
          FormItem.redrawn()
          DynamicForm._itemsRedrawn()
          DynamicForm.redraw("CanvasItem getting new size")
          Canvas.redrawIfDirty(reason=>"CanvasItem getting new size")
          CanvasItem.sizeCanvas(firstResizePass=>true)
          CanvasItem.checkCanvasOverflow()
          DynamicForm.getInnerHTML(printCallback=>completeInnerHTMLFun())
          Canvas._getInnerHTML(printCallback=>undef)
          Canvas._updateParentHTML(innerHTML=>undef)
          Canvas._updateHTML()
          Canvas.redraw(reason=>false)
          Class.invokeSuper(clazz=>null, methodName=>"redraw", a=>undef, b=>undef, c=>undef, d=>undef, e=>undef, f=>undef, g=>undef, h=>undef, i=>undef, j=>undef, lastArg=>undef)
          Class.Super(methodName=>"redraw", args=>[object Arguments], nativeArguments=>undef)
          ** recursed on DynamicForm.redraw
          "
          15:23:32.227:TMR0:WARN:Log:formatValue: "
          [a]StaticTextItem.formatValue(value=>undef, record=>Obj, form=>[DynamicForm ID:isc_DynamicForm_12], item=>[StaticTextItem ID:isc_StaticTextItem_20 name:FOTO])
          FormItem._formatDataType(value=>undef, asHTML=>undef, noLineBreaks=>undef)
          FormItem.mapValueToDisplay(value=>undef, recursed=>undef, includeValueIcons=>undef)
          FormItem._getDisplayValue(value=>undef, canUseCurrentValue=>undef)
          FormItem._showValue(newValue=>undef, resetCursor=>undef)
          FormItem.setValue(newValue=>undef, allowNullValue=>undef, timeCritical=>undef, dontResetCursor=>undef)
          FormItem.clearValue()
          DynamicForm.setItemValues(values=>Obj, onRedraw=>true, initTime=>undef, items=>undef, validating=>undef)
          DynamicForm.redraw("CanvasItem getting new size")
          Canvas.redrawIfDirty(reason=>"CanvasItem getting new size")
          CanvasItem.sizeCanvas(firstResizePass=>true)
          CanvasItem.checkCanvasOverflow()
          DynamicForm.getInnerHTML(printCallback=>completeInnerHTMLFun())
          Canvas._getInnerHTML(printCallback=>undef)
          Canvas._updateParentHTML(innerHTML=>undef)
          Canvas._updateHTML()
          Canvas.redraw(reason=>false)
          Class.invokeSuper(clazz=>null, methodName=>"redraw", a=>undef, b=>undef, c=>undef, d=>undef, e=>undef, f=>undef, g=>undef, h=>undef, i=>undef, j=>undef, lastArg=>undef)
          Class.Super(methodName=>"redraw", args=>[object Arguments], nativeArguments=>undef)
          ** recursed on DynamicForm.redraw
          "
          15:23:32.232:TMR0:DEBUG:redraws:clearRedrawQueue: 1 redraws (2 items), 19ms
          I’m not sure whether this output is actually useful, or how I should proceed from here to understand what is causing these repeated calls. Do you have any suggestions on what I should focus on next?

          Comment


            #20
            This output is extremely useful - there's a reason we work so hard on diagnostics! Although note you can get full stack traces in Chrome, instead of traces that have to end on the first recursion.

            Even with that browser limitation, these logs show that the form is being redrawn multiple times, and that's why your formatter is being called repeatedly.

            At least some of the redraws are due to a reflow, that is, something was not given a size in advance that was big enough, so it overflowed, and then other widgets had to change size in response. This is very common, and while inefficient, not especially worth chasing unless there's a human-noticeable delay.

            Comment


              #21
              Hi, any news about the regression of post #11 ?

              Comment

              Working...
              X