Announcement

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

    UploadItem.setDefaultProperties() problem when changing the title?

    Hi Isomorphic,

    I wanted to change the FormItem title for BatchUploader UploadItem in this sample. I got it working but wondered why my 1st approach did not work:

    I'm pretty sure that the generated item is an UploadItem after using the Developer Console's watch tab.
    I tried this at application startup at the very top of my onModuleLoad before any draw().
    Code:
            UploadItem ui = new UploadItem() {
                {
                    setTitle(i18n.fileToUpload());
                }
            };
            UploadItem.setDefaultProperties(ui);
    But the title is still "Upload file" and not my string "File to upload".

    Using this code it is working, but shouldn't the 1st method work as well?
    Code:
            UploadItem ui = new UploadItem();
            ui.setTitle(i18n.fileToUpload());
            BatchUploader.changeAutoChildDefaults("uploadFileItem", ui);
    I tired this using latest v10.1p_2017-01-03.

    Thank you & Best regards
    Blama

    #2
    Hi Isomorphic,

    I spoke to early:
    The changeAutoChildDefaults() does break the main BatchUploader functionality. After hitting upload there is no data in the grid.
    If I remove the three lines it is working again.

    Best regards
    Blama

    Comment


      #3
      The first approach would be expected to set a system-wide default title for all UploadItems anywhere. So it would not be expected to work in this case, since the BatchUploader sets a more specific title.

      The second approach is also wrong. The item in question is actually a FileItem, not an UploadItem. Since you just want to set title, there is no reason for you to reiterate the specific class of the item - just use a FormItem. This will then avoid broken functionality, which comes from your attempt to override what class is being used.

      Comment

      Working...
      X