Announcement

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

    AutoFitWidth doesn't respect minWidth in a ListGrid

    Hello,

    a ListGrid doesn't respect the minWidth setting of a ListGridField when the the field has also a autoFitWidth setting.
    Here is the example code:
    Code:
        public void onModuleLoad() {  
            VLayout layout = new VLayout();  
            layout.setWidth100();  
            layout.setHeight100();  
            layout.addMember(getListGrid());  
              
            layout.draw();  
        }  
          
        public ListGrid getListGrid () {  
           
            ListGrid listGrid = new ListGrid();
            
            ListGridField labelField = new ListGridField("label", "Label");
            labelField.setMinWidth(120);
            //labelField.setFrozen(true);
            labelField.setAutoFitWidth(true);
            
            ListGridField otherField = new ListGridField("other", "Other");
            otherField.setWidth("*");
            
            listGrid.setFields(labelField, otherField);
            
            ListGridRecord record = new ListGridRecord();
            record.setAttribute("label", "Label");
            record.setAttribute("other", "Other");
           
            listGrid.setData(new Record[] {record});
             
            return listGrid;  
        }
    The example is using Version v11.0p_2016-07-26/Pro Deployment (2016-07-26).

    The ListGrid looks like this:
    Click image for larger version

Name:	ListGrid.jpg
Views:	77
Size:	6.7 KB
ID:	239394

    When setting the frozen attribute for the field, there ist also a problem with the width of the ListGrid:
    Click image for larger version

Name:	ListGridFrozen.jpg
Views:	71
Size:	8.7 KB
ID:	239395

    This is a very simple example for a problem with the week view in a calendar I has told you over one month ago in this thread: http://forums.smartclient.com/forum/...-of-a-calendar

    Please fix this problem, because it prevent us tu use the version 6.0.

    Regards

    Peter

    #2
    Just also calling setWidth(120) should address your issue, if what you want is a field that can grow but not shrink - let us know if that doesn't work for you.

    Comment


      #3
      What I want is a solution for the problem with the week view in calendar, that I have described in the thread referenced above.
      In the calendar I can't set the width for the label column, because it is generated inside of SmartGWT.

      Comment


        #4
        I think it is an easy fix: Setting the width attribute for the label column in function rebuildFields of the DayScheduler fix it.
        Code:
            rebuildFields : function () {
                this.initCacheValues();
                var cal = this.calendar,
                    fields = [],
                    labelCol = {
                        autoFitWidth: true,
                        minWidth: this.labelColumnWidth,
        -->                width: this.labelColumnWidth,
                        name: "label",
                        frozen: true,
                        isLabelField: true,
                        title: " ",
                        cellAlign: "right",
                        calendar: cal,
        
        ...
        Can you please do it in the next build.

        Comment


          #5
          A few pixels change in width of a single column in a single component hardly seems like a reason to avoid an entire new version, especially given that the field was auto-sizing, so would have always have been wide enough for all values.

          But, yes, we've already made the necessary change, and it will be in builds as of tomorrow.

          Comment


            #6
            Thanks for the fix. The problem is, that we have combine to calendars in one view and its looks strange now:
            Click image for larger version

Name:	Calendar.jpg
Views:	61
Size:	159.9 KB
ID:	239402

            Comment

            Working...
            X