Results 1 to 2 of 2

Thread: Adjusting column width

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    221
    Answers
    10

    Default Adjusting column width

    Hi All,

    I am using ExtJs 4.1 framework. I have a grid in which all the columns are dynamically added. I want to adjust the width of the columns based on the content of first row. So If the content is number, I want to set the width of column to100px, if the content is string then the column width should be 200px if the content of the column is date then I want to change the width to 50 px. How can I do this?


    Please provide your suggestions.

    Thanks in advance.

  2. #2
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    384
    Answers
    2

    Default

    Ext.grid.column.Column has a setWidth() function. You could listen to the 'afterrender' event, and then iterate through the columns, calling setWidth() with the value you want to set. Make sure your grid doesnt have 'forceFit' set to true though, otherwise this probably wont work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •