Announcement

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

    UploadItem setMultiple true <-> setMultiple false not working properly

    Isomorphic,

    We are using smartgwt-pro 5.0-p20141210.
    Our browser is Firefox 24.0

    I have a DynamicForm with an UploadItem where depending on case I need to allow multiple file upload or single file upload.

    Then on the same DynamicForm (We use the same DynamicForm, we don't perform new DynamicForm each time), i will call several times and in different order :

    - uploadItem.setMultiple(true)
    - uploadItem.setMultiple(false)

    The behaviour i have :

    - setMultiple(false)
    - click on "Browse" -> I can only select one file in file chooser
    - setMultiple(true)
    - click on "Browse" -> I can select several files in file chooser
    - setMultiple(false)
    - click on "Browse" -> I can select several files in file chooser

    In my tests, i see that once i have performed a setMultiple(true), i can not go back to single file selection in file chooser.

    I have performed my tests in Firefox 24.0 and Firefox 38.0 and the behaviour is the same.

    Can you tell me please if it's an UploadItem's component bug, a Browser bug or if it's probably a problem in my code ?

    Thanks by advance.
    David.

    #2
    There are several ways it could be a problem in your code, but you didn't post any, so we can't say.

    You should also try updating to the latest patch build.

    Comment


      #3
      We've added a public setter, FileItem.setMultiple(), to 10.0 and 10.1 for builds dated August 23 and later.

      You should alter your code to use FileItem, instead of directly using UploadItem, and then use FileItem.setMultiple() to update the multiple setting that gets passed to the browser's file dialog at runtime.
      Last edited by Isomorphic; 22 Aug 2015, 04:33.

      Comment


        #4
        Thanks for the answer,
        In my first post i've missed an important information, we don't use SmartGWT server.

        Our client is developped in SmartGWT pro edition.
        Target browser is Firefox 24.
        Our server is hosted in JBoss EAP 6+ and we have implemented REST Web Services.

        In order to load images from client desktop and display on application running on Firefox 24, we have used an UploadItem because of this link :

        http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/docs/Upload.html :
        "Upload without the Smart GWT Server
        If it is acceptable that the application will do a full-page reload after the upload completes, you can simply:
        set encoding to "multipart"
        include an UploadItem to get a basic HTML upload control
        set action to a URL where you have deployed server-side code to handle the upload
        call DynamicForm.submitForm() to cause the form to be submitted"

        As I had a very (multiple very) hard time developping a solution to load and display an image, I created a thread to explain how I did it :
        http://forums.smartclient.com/showthread.php?t=32734

        On that thread, Isomorphic, you have answered me on 24/04/2015 :
        "This is a correct solution. It is a bit complicated, but this is the standard approach for doing a file upload without leaving the page."

        Now I hope i'm not missing any important information, can you confirm me Isomorphic, please, that using an UploadItem in our case (and not a FileItem) is the correct solution ?


        I still have a problem with the setMultiple(boolean) on UploadItem object.
        I create an UploadItem and setMultiple(false) on it, I can only choose one item in the File Chooser.
        Once i have performed a setMultiple(true), i can select several items in the File Chooser but after a setMultiple(false) has not effect.
        I open again the File Chooser and I can still choose several items instead of only one.
        Is that an identified issue you have patched in a recent nightly build ?

        Comment


          #5
          FileItem creates and uses an UploadItem when it's editable.

          The problem you have now is that "multiple" is not a runtime changeable attribute.

          The change we made to FileItem recreates its UploadItem with the new multiple setting.

          If you don't want to change to using a FileItem, or doing so doesn't work for you, you'll have to recreate your UploadItem yourself.

          Comment

          Working...
          X