We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Custom Column Widths

Hello,

Is it possible to set the column widths before the pivot table loads? Looking for a setting, but cannot find. 

Best,
Jay

4 Replies

JV Jay Velasco August 9, 2019 10:18 PM UTC

Answered my own question - there's the grid property in the pivot view. Can change the width and call the refreshColumns method. 


SA Scintilla Arul Jothi Raj Syncfusion Team August 12, 2019 04:23 AM UTC

Hi Jey,

Thanks for contacting Syncfusion support. Please find the response below.

 

You can change the coumnWidth of pivot table in the enginePopulated event. Please find the code snippet below.

 

Code snippet:[JavaScript]

enginePopulated: function (args) {

        this.gridSettings.columnWidth = 210;

    }

 

Sample link: https://stackblitz.com/edit/ptwcmh?file=index.ts

 

Please let us know if you have any concerns.

 

Regards,

Scintilla A



AG Ajay Gohil August 20, 2019 04:18 AM UTC

Try this code for set width of in kendo grid columns 
 columns: [ {
                        field: "OrderID",
                        title: "Order ID",
                        width: 150
                    }
                ]


SA Scintilla Arul Jothi Raj Syncfusion Team August 21, 2019 12:19 PM UTC

Hi Ajay, 

Thanks for the update. 

You can set width for specific columns of pivot table by using the event columnRender under the property gridSettings. 

Please find the following code snippet for your reference. 

Code snippet: [JavaScript] 
gridSettings: {   
          columnRender: function(args) { 
            for(var i=0; i < args.columns.length; i++) { 
            if(args.columns[i].headerText != undefined && args.columns[i].headerText.indexOf("Units Sold")> 0) 
                args.columns[i].width =210; // You can customize the width of specific column here. 
            } 
        }  
        } 
 
Screenshot: 
 
Note: You can only set width to the columns of the last row (Units Sold, Sold Amount etc..) of column axis. Based on its column width its parent column(Q1, Q2, FY 2015 etc..) width will be calculated. 
 
Please let us know if you have any concerns. 

Regards, 
Scintilla A 


Loader.
Live Chat Icon For mobile
Up arrow icon