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

Width Not Set When Defining Columns

Hi Syncfusion,

I define columns programatically like this:
and setting columns properties like this:

Everything works here except width. So headerText works, columns template works but width is stretched to the lenght of the longest cell. I do not use autoFitColumns. 

I can see in the code that widht is not added:

Why is width not applied to the grid?


3 Replies

BS Balaji Sekar Syncfusion Team January 13, 2020 11:57 AM UTC

Hi Marius, 
Greetings from syncfusion support. 
Query#: Why is width not applied to the grid? 
Based on your query we have prepared a sample and we suggest you to follow the below way to achieve your requirement. Please refer the below code example and sample for more information. 
var pvt = { 
    key: true 
export default { 
  data() { 
    return { 
      data: data, 
      grid: "", 
      toolbar: ["Add", "Delete", "Update", "Cancel"], 
      flag: true, 
      pageOption: { 
        pageSize: 12 
      editSettings: { 
        allowEditing: true, 
        allowAdding: true, 
        allowDeleting: true, 
        mode: "Batch" 
  methods: { 
    dataBound: function(args) { 
      var obj = {field: "ShipCountry", headerText: "Ship Country", width: "300"};    
      if(pvt.key) {            // you need to push this new column to the grid’s columns property and call the refreshColumns method to achieve your requirement 
        pvt.key = false;     //It helps to prevent the recursive call 
  provide: { 
    grid: [Edit, Toolbar, Page] 
Balaji Sekar. 

ML Marius Lian January 14, 2020 04:35 AM UTC

Ok, thank!

DR Dhivya Rajendran Syncfusion Team January 15, 2020 10:55 AM UTC

Hi Marius, 

Thanks for your update. Please get back to us if you need further assistance from us. 


Live Chat Icon For mobile
Up arrow icon