Columns Displayed Out of Order

I've defined Grid Columns in the initial order I'd like them displayed but upon display, the columns are displayed in what I assume is a random order.

How do I get the columns to display as I've defined them?  BTW, this seems to be happening in hierarchal grids.



                                    <GridColumns>
                                    @{ 
                                        var recipient = Recipients.FirstOrDefault(r => r.CareReceiverId == caregiver.CareReceiverId);
                                        <GridForeignColumn Field=@nameof(recipient.CareReceiverId) HeaderText="Name" Type="ColumnType.String" ForeignDataSource=@Recipients ForeignKeyField="CareReceiverId" ForeignKeyValue="FullName" Width="280px" />
                                        @*<GridForeignColumn Field=@nameof(recipient.FacilityId) ForeignDataSource=@Facilities ForeignKeyField="FacilityId" ForeignKeyValue="Name" HeaderText="Facility" Type="ColumnType.String" Width="500px" />*@
                                        <GridColumn Field=@nameof(recipient.ContactPhone) HeaderText="Contact Phone" Type="ColumnType.String" Width="250px" />
                                        <GridForeignColumn Field=@nameof(recipient.CareReceiverId) ForeignDataSource="CareNotes" ForeignKeyField="CareReceiverId" ForeignKeyValue="Note" HeaderText="Note" Type="ColumnType.String" Format="d" Width="250px" />
                                        <GridForeignColumn Field=@nameof(recipient.CareReceiverId) ForeignDataSource=CareNotes ForeignKeyField="CareReceiverId" ForeignKeyValue="ContactDate" HeaderText="Contacted" Type="ColumnType.Date" Format="d" Width="250px" />
                                    }
                                    </GridColumns>


5 Replies 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team March 31, 2021 04:33 AM UTC

Hi Mike,  
 
Thanks for contacting Syncfusion support.  
 
Query: “How do I get the columns to display as I've defined them?  BTW, this seems to be happening in hierarchal grids. 
 
We have analyzed the reported query and we understand that you are facing issue with column order in hierarchy Grid. We need some more details to validate the reported query further at our end. So kindly share the following details.  
 
  1. By default Field property of GridColumn will be defined from its model class. But in your code example you have defined them as a variable. (i.e.) recipient in the Field=@nameof(recipient.CareReceiverId) represents model class. but you have defined it like a variable. Kindly share more details about it.
  2.  Share your entire Grid code example along with your model class.
  3. Are you facing any script error / exception in browser console. If yes, share the screenshot of the issue.
  4. Have your enabled persistence in Grid?.
  5. Share details about your Syncfusion.Blazor Nuget package version.
  6. If possible share a simple issue reproducible sample.
 
Above requested details will be very helpful for us to validate the reported query at our end and provide solution as early as possible.    
 
Regards, 
Vignesh Natarajan  


Marked as answer

MC Mike Chafin April 1, 2021 11:53 AM UTC

It may be a little later before I respond to your request.  In the meantime, I changed to a DTO object and it seems to be working good.


VN Vignesh Natarajan Syncfusion Team April 2, 2021 03:04 AM UTC

Hi Mike,  

Thanks for the update.  

We are glad to hear that you have resolved your query on your own.  

Kindly get back to us with more details if you have further queries.  

Regards, 
Vignesh Natarajan 



MC Mike Chafin April 9, 2021 04:15 PM UTC

Apparently, this was caused by having the same ID on the parent as the child. Once I made the ID unique on each the column jumble and other issues went away.  

Why this happened was that the child gird is a component nested into the parent. The developers used the same ID.when creating the components



VN Vignesh Natarajan Syncfusion Team April 12, 2021 06:17 AM UTC

Hi Mike,  
 
Query: “Why this happened was that the child gird is a component nested into the parent. The developers used the same ID.when creating the components 
 
We have analyzed the reported query and we suspect that you have faced the reported issue when Parent and Child Grid has similar Id. We would like to inform you that we will use the id specified in ID property of Grid when it is defined otherwise we will generate a unique ID (with sfgrid followed by random variable) for each Blazor components ie (parent and Child Grid).  
 
If you are facing the reported issue (same id generated for multiple Grid), kindly get back to us with more details to validate the reported query further at our end.   
 
Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon