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


                #22
                Hi Claudio
                We have been analyzing what's going on with that regression and we're looking at some small refactoring of this item to address the problem and generally make everything better documented and more intuitive.
                We'll follow up here when this work is complete with a complete explanation

                Regards
                Isomorphic Software

                Comment


                  #23
                  thanks for the update - really appreciate the work and effort you’re putting into this.
                  Looking forward to the follow-up.

                  Comment


                    #24
                    Hi, you may have already noticed this, but as part of the regression related to ViewFileItem, I’m also seeing that if the ViewFileItem is readOnly and I edit a record using form.editRecord(record), then call form.saveData() after modifying another item in the form, an add operation is performed (with the form “child” as the componentId) instead of an update.

                    Comment


                      #25
                      Hi Claudio
                      We're still finalizing some fixes and doing some testing in this area.
                      We should have the issue posted in #11 resolved backported to 13.1 soon. We'll update this thread as soon as it's available.

                      Can we request that you start a new thread for the issue described in post #24.

                      Thanks and Regards
                      Isomorphic Software

                      Comment


                        #26
                        Hi, I just wanted to check whether there have been any further developments regarding the fix for issue #11.

                        I will open a new thread for another issue (I should note that I haven’t observed the behaviour described in post #24 in recent builds)

                        Comment


                          #27
                          Hi, I wanted to ask whether there have been any changes regarding this, as mentioned in post #25.

                          Also, I wanted to report that if I modify the #upload example in the following way:

                          Code:
                          isc.DynamicForm.create({
                              autoDraw: true,
                              ID: "uploadForm", width: 300,
                              dataSource: mediaLibrary,
                              fields: [
                                  { name: "title", required: true },
                                  { name: "image", type: "imageFile", multiple:false, hint: "Maximum file size is 5 MiB" , required:false},
                                  { title: "Save", type: "button",
                                      click: function () {
                                          this.form.saveData();
                                      }
                                  }
                              ]
                          });
                          specifically by removing the callback from the saveData() call - after saving, the FileItem gets cleared.
                          However, if I then save the form a second time without selecting a file again, null is sent as the value for image, together with the metadata from the previously uploaded file:

                          Code:
                          {
                              dataSource:"mediaLibrary",
                              operationType:"update",
                              componentId:"isc_DynamicForm_0",
                              data:{
                                  image:null,
                                  title:"foobar",
                                  image_filename:"photo.jpeg",
                                  pk:3,
                                  image_filesize:3936,
                                  image_date_created:"2026-05-12T14:13:26.000"
                              },
                              ...
                          I’m not sure whether this is the intended behaviour.

                          Comment


                            #28
                            Hi Claudio
                            The issues in post #11, where the ViewFileItem was failing to show either previews or icons (depending on showFileInline) should all be resolved and working in all branches (13.1 and above). We apologize for not following up after post #25

                            Are you still seeing the problems referenced in post #11 in your environment?

                            RE your other question - the cleared out "image" attribute should be fine. This is mentioned in the "Uploading Files" overview document here:
                            https://smartclient.com/smartclient-...=group..upload

                            Note that FileItems cannot be programmatically populated - this is a browser security restriction over which we have no control. This restriction means that we are unable to populate a FileItem with the correct filename when a form is editing an existing record. Also, when you call saveData() on a form that is editing a new record, the FileItem will be cleared on successful completion of the saveData() call; this is a side-effect of the form being placed into "edit" mode. In both of these cases, the fact that the FileItem has been cleared will not cause the persisted binary data to be removed by SmartClient Server on subsequent calls to setData(). If the user selects another file, it will overwrite the existing one; if the FileItem is left blank, the server simply ignores it. If you actually wish to wipe out the value of a binary field, call updateData() on the underlying dataSource, passing an explicit null value for the binary field.
                            In short - we are not aware of any remaining open issues from this thread. If you are seeing problems that still need to be resolved here, please let us know!

                            Regards
                            Isomorphic Software

                            Comment

                            Working...
                            X