How to get the Header height of a DataGrid when using the textWrapSettings property for header?

Hi Sujith,

After use the textWrapSettings for header, the header height is not a fixed value, can we get this value? can we can get notify event when the height of a data grid is changed?

Thanks,
chunfeng

3 Replies

RS Rajapandiyan Settu Syncfusion Team April 7, 2020 01:57 PM UTC

Hi Chunfeng, 
 
Greetings from syncfusion support. 
 
Query : After use the textWrapSettings for header, the header height is not a fixed value, can we get this value? can we can get notify event when the height of a data grid is changed? 
 
Yes, you can able to get the grid header height in Grid’s dataBound and actionComplete. dataBound event is used to get the header height at initial rendering. After every Grid actions like Reordering, Grouping, etc., grid’s header is refreshed and you can get its height in the grid’s actionComplete event. Please refer the below code example and sample for more information. 
 
 
methods: { 
    dataBound: function(args) { 
      if (this.flag) { 
// get the headercells 
         var headercells = this.$refs.grid.$el.getElementsByClassName('e-headercell'); 
         console.log(headercells[0].offsetHeight); //get the header cell height 
        this.flag = false; 
      } 
      
    }, 
    actionComplete: function(args) { 
       var headercells = this.$refs.grid.$el.getElementsByClassName('e-headercell'); 
         console.log(headercells[0].offsetHeight); 
    } 
  }, 
 
 
 
 
 
 
Please get back to us if you need further assistance on this. 
 
Regards, 
Rajapandiyan S


CZ CZ April 7, 2020 09:03 PM UTC

Thanks
chunfeng


RS Rajapandiyan Settu Syncfusion Team April 8, 2020 05:20 AM UTC

Hi Chunfeng, 

Thanks for your update. We are glad that the provided solution resolved your requirement. Please get back to us if you need further assistance on this. 

Regards, 
Rajapandiyan S 


Loader.
Up arrow icon