Fix value for column width

Posted by: aniket.bhavsar on 23 January 2018, 10:52 pm EST

    • Post Options:
    • Link

    Posted 23 January 2018, 10:52 pm EST

    Hello Folks,

    I am using Pivot grid. I want know how i can set column width by user define or fix column width.

    												Appreciate
    
  • Posted 24 January 2018, 4:18 pm EST

    HI Aniket,

    For this, you need to set columns width within updatingView event. Please refer to the following code snippet for the same.

    app.pivotGrid.updatingView.addHandler(function(s,e){
                   s.columns[0].width=555;
               })
    

    ~Manish

  • Posted 28 January 2018, 5:12 pm EST

    Hi Manish,

    I want to change and keep user define width in Java script side ( Not in Html side ). ie when user come on grid it set on user define size on attribute. Looking for solution in both Pivot grid and Flex grid.

    																Thanks,
    																Aniket B.
    
  • Posted 28 January 2018, 11:52 pm EST

    Hi Aniket,

    The Code snippet given by manish is for JS only and we are not setting it on the HTML content. Unfortunately we are unable to understand your requirement further, could you please elaborate.

  • Posted 29 January 2018, 12:22 am EST

    Thank You For Responding. When i try to set s.columns[0].width=555; it will setting value for only numeric data ie above image ( expenses and sales ) I want set a column width for string like country, product, color in image. If you see product above banana i wrote like ( banana banana banana banana ) but it only looks ( banana banana ). So i want to know how i can set column width for product (in above image column) by user define in Type script. In both OLAP and Flex gird.

  • Posted 29 January 2018, 12:26 am EST

    Column names are stored via Index Only an the text that you are seeing is actually the column Header Name. If you want to set the Width based on Text Data then, I would suggest you to first save the Width Information for each Column based on the name somewhere in your configuration setting.

    After than you will have to iterate through the Column Collection, match by its name and then set the Width from the configuration settings.

    This approach is applicable to both FlexGrid and Pivot Grid ( Pivot Grid is internally a FlexGrid).

  • Posted 29 January 2018, 4:19 am EST

    Thank you so much Abhishek for quick replay. I really appreciate for that . can you please provide me any sample code or Plunker demo which i can see a code and easily understand how to iterate through the Column Collection, and match by its name and then set the Width from the configuration settings.

    Here i send jsfiddle. ( http://jsfiddle.net/2690at66/ )

  • Posted 29 January 2018, 6:17 pm EST

    Hi Aniket,

    If you would like to set width for PivotGrid rowFields column’s width, you may set width by setting in PivotField.

    Please refer to the following fiddle for the same:

    Width set for PivotField=> http://jsfiddle.net/2690at66/1/

    Since Product column is placed in PivotGrid row header section, you need to set the width for rowHeaders section columns width. Please refer to the following fiddle:

    http://jsfiddle.net/2690at66/2/

    ~Manish

  • Posted 29 January 2018, 7:59 pm EST

    Thank you so much Mr.Manish. I really appreciate for providing jsfiddle.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels