Custom DataGrid

Hallo!

Is it possible to create a custom datagrid, like a 2 column table? Instead of a collection of objects i only want to display 1 single object with several properties, that are sums of an invoice.
Therefore, I want to make one column as identifier and the other column for the sums. In the DataGrid footer of the sums column I want to display the total sum.

Identifier......................Sum (€)


Commission................100
Transport.....................250
...

Is something like that possible?

Kind regards

Hi @Benjey,

The DataGrid will display whatever data you provide :slight_smile: If you want to transpose the rows and columns - this isn't supported.

Thanks for the answer.

But can i create a custom grid? Custom columns and custom rows? Like:

                <Columns>
                    <RadzenGridColumn Title="Position">
                        <Template>
                            <RadzenLabel Text="Commission"></RadzenLabel>
                            <RadzenLabel Text="Transport"></RadzenLabel>
                        </Template>
                    </RadzenGridColumn>
                    <RadzenGridColumn Title="Sum (€)">
                        <Template>
                            <RadzenLabel Text="@myObject.Commission"></RadzenLabel>
                            <RadzenLabel Text="@myObject.Transport"></RadzenLabel>
                        </Template>
                    </RadzenGridColumn>
                </Columns>
            </RadzenGrid>

Edit: i don't know how to properly post code :confused:

The DataGrid creates a row for every item of the Data property. If you set it to null it will remain empty. It should contain at least one item.

This forum supports Markdown. To add code wrap it with ``` e.g.

1 Like

Ok so if I understand correctly: I can not manually add rows?
Data has to have at least one item, otherwise the whole DataGrid will remain empty?
Is that correct?

Yes, Data has to have at least one item (could be anything). Since your columns have a template - they will display the template no matter what the data item is.

1 Like

Thank you, I managed to solve it :slight_smile:

First I created a new class for the positions of an invoice and use it to populate my list.
image
Then i use a standard DataGrid with the positions as Data.

Result:
image

I have many more positions but I just wanted to get it to work for now. Thank you very much! :smiley: