SfGrid display results horizontally in grid

Hi

I am using a SfGrid in  Syncfusion Blazor 26.x.  I want to display results horizontally, rather than vertically.  So as the page is resized it will take up the width of screen and put the next result to the right.  I thought a simple float:left or display:flex would have done it but it didnt. I think its because it uses a table.  I wanted to use the SfGrid so I can keep all the paging, sorting, filtering etc...

my CSS is 

.VehicleGridClass {

    display: flex !important; /* Ensure flexbox is applied */

    flex-wrap: wrap !important; /* Ensure wrapping */

    gap: 16px;

    justify-content: flex-start;

    border: 2px dashed blue; /* To visualize the grid container */

    width: 100%;

}


.VehicleGridItem {

    display: inline-block !important;

    width: 450px !important;

    max-width: 450px !important;

    box-sizing: border-box;

    border: 2px solid red; /* To visualize each item */

}

My SfGrid is:

<div class="VehicleGridClass">

    <SfGrid @ref="@DataGrid" DataSource="@GridData" TValue="VehicleModel" ID="Grid1">

        <GridColumns>

            <GridColumn >

                <Template>

                    @{

                        var data = (context as VehicleModel);

                        <div class="VehicleGridItem" >

                            @data?.ftp_plate

                        </div>

                    }

                </Template>

            </GridColumn>

        </GridColumns>

    </SfGrid>

</div>


1 Reply

PS Prathap Senthil Syncfusion Team August 22, 2024 12:56 PM UTC

Hi Indy Gill,


We have analyzed your query and suspect that you want to render a transposed grid (inverted rows and columns). Although we do not have direct support for a transposed grid, you can achieve this by using the ColumnTemplate feature of the Grid with ExpandoObject. We have discussed this solution in the forum thread linked below:


https://www.syncfusion.com/forums/161011/is-there-a-way-to-invert-the-rows-and-columns-in-a-grid

Please note: This solution is only suitable for display purposes; CRUD operations and data operations will not work.


Additionally, if you want the grid to adapt its layout when the page is resized, we recommend using the Adaptive feature for an optimal viewing experience and improved usability on small screens. For more details, please refer to the documentation linked below.

https://blazor.syncfusion.com/documentation/datagrid/adaptive-layout


Regards,
Prathap Senthil


Loader.
Up arrow icon