Announcement

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

    Resize listgridfield according to title fails

    Hi,
    I have found some behaviour which shouldn't be so like state in the documentation.


    Here you can see what happens using autoFitField. This method is also used if you doubeclick on the separator between the row-header.

    In the documentation this the fit is happening the content or the title of the listgridfield. You can see in the gif, that the only thing which is considered is the content of the field.
    Code:
    int autoFitField (fieldName)
    
    Programmatically cause a field to auto-fit horizontally to it's contents or title.
    Does not establish permanent auto-fitting - use ListGrid.setAutoFitWidth() to do so. 
    
    Parameters:
        fieldName  - type: String
    Is there a additional attribute, which has to be set for considering not only content of the row, but also the title of the row?

    Here is the code for reproduction:
    Code:
    isc.ListGrid.create({
    	"ID" : "theListGrid",
    	"width" : "400",
    	"alternateRecordStyles" : true,
    	"modalEditing" : true,
    	"fields" :
    	[
    		{
    			"name" : "long",
    			"title" : "Longer title",
    			"type" : "text",
    			"canEdit" : false
    		}, {
    			"name" : "short",
    			"title" : "Shorter title",
    			"type" : "text",
    			"canEdit" : false
    		}
    	],
    
    	"data" :
    	[{
    			"long" : "abc",
    			"short" : "This is a long text to show the resize behaviour",
    		}, {
    			"long" : "abc",
    			"short" : "shorten",
    		}
    	]
    });
    isc.Button.create({
    	"action" : function () {
    		theListGrid.autoFitField("long");
    	},
    	"title" : 'autofit first',
    	top : 100,
    	left : 0
    });
    isc.Button.create({
    	"action" : function () {
    		theListGrid.autoFitField("short");
    	},
    	"title" : 'autofit second',
    	top : 100,
    	left : 100
    });
    Best regards

    #2
    You simply need to set autoFitWidthApproach -- options are "both", "title" or "value" - and it can be set for the grid as a whole or for specific fields.

    Docs here.

    Regards
    Isomorphic Software

    Comment


      #3
      thanks, i was searching for that :-)

      maybe a link in the doc to the method in autoFitField would be helpful for the next user.

      Comment


        #4
        Good point - we've added a link to the docs

        Comment

        Working...
        X