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

Grid issue when adding the first row, some of the columns or custom buttons move to the right and are not visible


I'm working with the grid and it does not fit the entire row when I add data the first time:

After the first time, the next rows that are added, the grid looks correctly:

Any way to fix this? I attach the view that I'm using.

Thanks, regards!

Attachment: Index_5e43d8d.zip

3 Replies

DR Dhivya Rajendran Syncfusion Team August 8, 2019 12:30 PM UTC

Hi Daniel, 

Thanks for contacting Syncfusion support. 

We have validated the provided information and code example. In your application, you are using autoFitColumns method in dataBound event by default while using autofitColumn then it calculate width for the columns based on the grid content so when use command column there is no header and  content(when have no data) so it took min width(it need extra width) for that command column. 

We suggest you to apply the static width for the command column and perform autofit other than command column when grid have no data. Please refer the below code example for more information. 

@(Html.EJS().Grid("HojasGrid").Columns(col => 
                . . . . . . 
function dataBound(args) { 
        if (this.curretViewRecords.length > 0) {  // check grid have data  
            this.autoFitColumns(["SheetID", "PatientID", "NurseID", "Created"]);// skip command column         } else { 
            this.autoFitColumns(); //you can either do the above or perform autofit for all columns() 


DA Daniel August 8, 2019 04:12 PM UTC

Hi Dhivya,

Thanks for your help, with your code I had the idea to resolve my issue. 

Just to clarify, the method you wrote me is not correct and the code were reversed. This was the final code:

function dataBound(args) {
if (this.currentViewData.length > 0) {
} else {
this.autoFitColumns(["SheetID", "PatientID", "NurseID", "Created"]);

Thanks again! Regards!

DR Dhivya Rajendran Syncfusion Team August 9, 2019 05:25 AM UTC

Hi Daniel, 

Sorry for the inconvenience caused. 

We suggest you to use currentViewData or getCurrentViewRecords() method to find whether the grid has data or not. Please get back to us if you need further assistance on this. 


Live Chat Icon For mobile
Up arrow icon