Announcement

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

    FileItem Width not getting set

    Hi,
    I am using a FileItem for file upload. Setting the width of the control using setWidth is not having any impact. The FileItem spans the entire form. Setting the Form width also has no effect. What am I missing here.. How to set the width for the FileItem control? Thanks for any help.

    I am using smartGWT 1.03r395 on ubuntu 8.1

    #2
    Can you show the code for your form, along with your attempt to set the width?

    Comment


      #3
      A simple testcase

      I am not able to decrease / increase the width of the FileItem

      Code:
      public void onModuleLoad() {
      
            DynamicForm countryForm = new DynamicForm();      
            countryForm.setBorder("2px solid blue");
            countryForm.setWidth("70%");
      
            TextItem myText = new TextItem("Country");      
            myText.setWidth("300");
            FileItem fiUpload = new FileItem();
            fiUpload.setName("countryupload");
            fiUpload.setTitle("Upload Country");
            fiUpload.setWidth("300");
            
            countryForm.setFields(myText,fiUpload);
         
            HLayout mainLayout = new HLayout();  
            mainLayout.setLayoutMargin(15);  
            mainLayout.setWidth("100%");  
            mainLayout.setHeight("100%"); 
            mainLayout.setBorder("5px solid green");
            mainLayout.addMember(countryForm);
            mainLayout.draw();
        }
      Last edited by ADA; 25 Mar 2009, 21:44.

      Comment


        #4
        Code for FileItem Width not getting set

        Can anyone pls help reg why the FileItem Width is not getting set. The code is provided below. Thanks

        Code:
        public void onModuleLoad() {
        
              DynamicForm countryForm = new DynamicForm();      
              countryForm.setBorder("2px solid blue");
              countryForm.setWidth("70%");
        
              TextItem myText = new TextItem("Country");      
              myText.setWidth("300");
              FileItem fiUpload = new FileItem();
              fiUpload.setName("countryupload");
              fiUpload.setTitle("Upload Country");
              fiUpload.setWidth("300");
              
              countryForm.setFields(myText,fiUpload);
           
              HLayout mainLayout = new HLayout();  
              mainLayout.setLayoutMargin(15);  
              mainLayout.setWidth("100%");  
              mainLayout.setHeight("100%"); 
              mainLayout.setBorder("5px solid green");
              mainLayout.addMember(countryForm);
              mainLayout.draw();
          }

        Comment


          #5
          FileItem Width

          We`re having the same issue. How can we set the width of the FileItem ?

          setWidth() on the FileItem doesn`t seem to be doing anything.

          Thanks,
          Stonebranch

          Comment


            #6
            @stonebranch1 The code samples posted before show the wrong signature being used - use the signature that takes an int to set a fixed width. Is that the problem for you?

            Comment


              #7
              Isomorphic, I tried both ( fItem.setWidth(300) and fItem.setWidth("300") ) but none of them work.

              Stonebranch

              p.s. In our application we also have UploadItem, and setting the width works fine for UploadItem.

              Comment


                #8
                Thanks for the code sample
                We've now fixed the FileItem so it will apply widths in the same way that UploadItem does. This change should hit svn in the near future.

                One thing to note here: Mozilla Firefox has some native limitations to how upload items (native INPUT type=FILE items) are rendered, which prevents us from applying widths to FileItems or UploadItems in that browser. Therefore, while this change will allow you to apply a custom width to your UploadItem in your application in Internet Explorer you should be aware that widths can't reliably be set for these items in all browsers

                Thanks
                Isomorphic Software

                Comment


                  #9
                  Hi,

                  As I check the FileItem Width not effective issue on the following version
                  3.0 Power Edition
                  3.1p Enterprise Edition
                  4.0d Enterprise Edition

                  But still find the issue that cannot find effect after set width of FileItem component

                  Do you know whether any version of SmartGWT have fixed on this issue?

                  Comment


                    #10
                    further details on FileItem width

                    Originally posted by Isomorphic View Post
                    Thanks for the code sample
                    We've now fixed the FileItem so it will apply widths in the same way that UploadItem does. This change should hit svn in the near future.

                    One thing to note here: Mozilla Firefox has some native limitations to how upload items (native INPUT type=FILE items) are rendered, which prevents us from applying widths to FileItems or UploadItems in that browser. Therefore, while this change will allow you to apply a custom width to your UploadItem in your application in Internet Explorer you should be aware that widths can't reliably be set for these items in all browsers
                    Isomorphic Software
                    GWT Version: 2.5.0
                    SmartGWT Version: 3.1-p20130419

                    I’m experiencing the same issues.

                    Here is what I have tried so far that has no effect:
                    • FileItem.setWidth(“*”)
                    • FileItem.setColSpan(3)
                    • increase the width of the column in DynamicForm


                    I found that explicitly setting the width with setWidth(300), for example, to be the most effective. Here are my results:
                    • Chrome: expands appropriately but its hard to tell because it doesn’t enclose the file name in borders.
                    • IE9: appropriately expands the bordered textbox.
                    • FF20: setWidth has no affect
                    • in all cases the button stays the same width
                    • in all cases setColSpan has no affect. This part of FileItem will only occupy one cell in DynamicForm.


                    It looks as though this is highly browser dependent and we pretty much have to take whatever rendering the browser provides.

                    Comment


                      #11
                      Yes, that's correct. For security reasons, browsers reject most visual and functional customization of "file" input items. See the docs for more details.

                      Comment

                      Working...
                      X