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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

146544 Aug 7,2019 05:06 PM UTC Aug 9,2019 05:25 AM UTC ASP.NET MVC - EJ 2 3
loading
Tags: Grid
Daniel
Asked On August 7, 2019 05:06 PM UTC

Hi!

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

Dhivya Rajendran [Syncfusion]
Replied On 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 => 
            { 
                . . . . . . 
               col.HeaderText("").Width("250").Commands(commands).Add(); 
            }) 
           .DataBound("dataBound") 
            .Render() 
) 
 
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() 
        } 
    } 

Regards, 
R.Dhivya 


Daniel
Replied On 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) {
this.autoFitColumns();
} else {
this.autoFitColumns(["SheetID", "PatientID", "NurseID", "Created"]);
}

Thanks again! Regards!

Dhivya Rajendran [Syncfusion]
Replied On 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. 

Regards, 
R.Dhivya 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon