|
SfGrid<EmployeeData> FirstLevelGrid;
...
public Query GetEmployeesQuery(EmployeeData value)
{
return new Query().Where("EmployeeID", "equal", value.EmployeeID).AddParams("ParentID", FirstLevelGrid.ID).AddParams("EmployeeValue",value.EmployeeID);
}
|
|
<SfGrid @ref="FirstLevelGrid" ID="FirstLevelParentGrid" DataSource="@Employees">
...
<GridTemplates>
<DetailTemplate>
@{
var employee = (context as EmployeeData);
var EmployeeIDKeyValue = employee.EmployeeID;
<SfGrid @ref="SecondLevelGrid" TValue="Order" Query="@GetEmployeesQuery(employee)" ...>
<GridEvents OnActionBegin="SecondGridActionBegin" TValue="Order"></GridEvents>
...
<SfDataManager Url="https://js.syncfusion.com/demos/ejservices/Wcf/Northwind.svc/Orders" CrossDomain="true"></SfDataManager>
<GridTemplates>
<DetailTemplate Context="CustomerContext">
...
</DetailTemplate>
</GridTemplates>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="110"> </GridColumn> ...
</GridColumns>
</SfGrid>
}
</DetailTemplate>
</GridTemplates>
<GridColumns>
<GridColumn Field=@nameof(EmployeeData.EmployeeID) HeaderText="Employee ID" TextAlign="TextAlign.Right" Width="110"> </GridColumn>
...
</GridColumns>
</SfGrid>
|
I am having a similar issue to Walter Martin. I now I have the ParentId that I need inside the Child Grid. I need to access that ParentId when in creating a new View Model in the "Add" action, so that I can then pass that through the request which relies on that Id. I have tried the previous solutions but had no luck, as I think I need to set the ParentId on the Add action. I am not using the Data Manager.
Any help would be appreciated.
Hi Aliyah,
We have reviewed your query and it appears that you are encountering an problem
when trying to access the ParentId while creating a new View Model in the
"Add" action within the child grid. In the provided code, the parent
and child grid Tvalues are the same. However, we would like to inform that each
grid has its own separate Tvalue. We prepared the simple sample attached in the
ticket.
If we misunderstand the query please give more details, Kindly share the below
details to validate further at our end.
The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.
Regards,
Naveen Palanivel