CurrentCell value always null on details grid.
Hi!
I try use CurrentCellActivated on the SfDataGrid details view but not working. The 'a' value always is null. If call from main SfDataGrid, the 'a' value is correct.
What the problem? How to get CurrentCell from the detail grid?
What the problem? How to get CurrentCell from the detail grid?
<syncfusion:SfDataGrid ItemsSource="{Binding Main}"
AllowEditing="True"
AllowDeleting="True"
AllowFiltering="True"
AllowSorting="True"
AutoGenerateColumns="False"
AutoGenerateRelations="False"
ColumnSizer="Star"
AddNewRowPosition="Bottom"
SelectionUnit="Cell"
SelectionMode="Single"
CurrentCellActivated="SfDataGrid_OnCurrentCellActivated"
NavigationMode="Cell">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridComboBoxColumn HeaderText="Title"
MappingName="Title">
</syncfusion:GridComboBoxColumn>
</syncfusion:SfDataGrid.Columns>
<syncfusion:SfDataGrid.DetailsViewDefinition>
<syncfusion:GridViewDefinition RelationalColumn="Detail">
<syncfusion:GridViewDefinition.DataGrid>
<syncfusion:SfDataGrid AllowEditing="True"
AllowDeleting="True"
AllowFiltering="True"
AllowSorting="True"
AutoGenerateColumns="False"
ColumnSizer="Star"
EditTrigger="OnTap"
NavigationMode="Cell"
AddNewRowPosition="Bottom"
SelectionUnit="Cell"
SelectionMode="Single"
CurrentCellActivated="SfDataGrid_OnCurrentCellActivated">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridNumericColumn HeaderText="Count"
NumberDecimalDigits="0"
MappingName="Count"/>
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>
</syncfusion:GridViewDefinition.DataGrid>
</syncfusion:GridViewDefinition>
</syncfusion:SfDataGrid.DetailsViewDefinition>
</syncfusion:SfDataGrid>
private void SfDataGrid_OnCurrentCellActivated(object sender, CurrentCellActivatedEventArgs e)
{
if (sender is SfDataGrid grid)
{
grid.SelectionController.CurrentCellManager.BeginEdit();
var a = grid.SelectionController.CurrentCellManager.CurrentCell;
}
}
SIGN IN To post a reply.
3 Replies
MA
Mohanram Anbukkarasu
Syncfusion Team
September 2, 2020 11:03 AM UTC
Hi Peter,
Thanks for contacting Syncfusion support.
You can get the current cell value of the DetailsView DataGrid within the CurrentCellActivated event as shown in the following code example.
Code example :
|
private void DetailsViewGrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs e)
{
if (e.OriginalSender is DetailsViewDataGrid grid)
{
var detailsViewDataGrid = e.OriginalSender as DetailsViewDataGrid;
var currentCell = detailsViewDataGrid.SelectionController.CurrentCellManager.CurrentCell;
}
} |
Sample link : https://www.syncfusion.com/downloads/support/forum/157466/ze/SfDataGrid_DetailsView_CurrentCell-82825769
KB reference : https://www.syncfusion.com/kb/6308/how-to-get-the-currentcell-for-detailsviewdatagrid-at-runtime
Please let us know if you require further assistance from us.
Regards,
Mohanram A.
AA
Adriano Arroyo
October 4, 2021 09:37 PM UTC
hi, i have the following problem: i'm doing a master detail with crud operations. in the row validating event I call an api to execute insert (async task <bool> method) but, when the response arrives, the value of e.originalSender.view is lost.
This only happens when I call the api.
I need the .view.isAddIem or isEdditItem to cancel the commit in case the insert doesn't get executed.
MA
Mohanram Anbukkarasu
Syncfusion Team
October 5, 2021 12:36 PM UTC
Hi Adriano,
Thanks for the update.
We regret to let you know that we are little unclear about the scenario of calling api. Kindly revert to us with more details and the code snippets used within the RowValidating event. It will be more helpful for us to check the exact cause for the problem and to provide a prompt solution.
Regards,
Mohanram A.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
PB Peter Barasits
- Sep 1, 2020 07:18 AM UTC
- Oct 5, 2021 12:36 PM UTC