Selva
Selva

Reputation: 1151

How to edit the New row template in Blazorise.Datagrid?

I am trying out Blazorise datagrid to display rows and add new rows. I would like to customize the Salary field such that there is a + button on the new row form. This + button will retrieve the Salary based on certain criteria using AJAX call. Is it possible to do? enter image description here

I took the screenshot from https://blazorise.com/docs/extensions/datagrid/templates

Upvotes: 0

Views: 1029

Answers (1)

Mladen Macanović
Mladen Macanović

Reputation: 1194

You can do this by adding an EditTemplate and defining the Select and Button components manually.

A quick example that will give you an idea:

<DataGridColumn Field="Salary">
  <EditTemplate>
    <Select TValue="decimal" SelectedValue="@((decimal)context.CellValue)" SelectedValueChanged="@(v=>context.CellValue = v)"
      ...
    </Select>
    <Button Color="Color.Primary>Add</Button>
  </EditTemplate>
</DataGridColumn>

Upvotes: 1

Related Questions