Hierarchy Grid: Sending ParentId
Attachment: payload_a3d1b229.zip
- Share the details regarding the exact scenario where you need to fetch the parent Grid id.
- Share the details regarding where you will be fetching the request payload. Have you used any event to fetch the data in request payload?
- Share your complete Grid rendering codes. Have you used SfDataManager to bind data in Grid?
- Share with us a detailed explanation of your complete requirement.
Attachment: Index_a57e2f44.zip
|
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.
Attachment: PlanTaskHierarchy_99d0ed19.zip
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.
- Share us the entire Grid code snippet along with model class
- Share a video demonstration of the issue with a detailed explanation. This will greatly assist us in understanding the problem.
- Please provide a simple sample that reproduces the issue with duplicate data or try to modify the above mentioned sample.
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
Attachment: BlazorApp4_81d907cd.zip
- 11 Replies
- 5 Participants
- Marked answer
-
ZY Zhi Yuan
- Oct 14, 2020 01:05 AM UTC
- Nov 7, 2023 02:58 AM UTC