- Home
- Forum
- ASP.NET Core - EJ 2
- Sample of Heirarchial grid with add, edit and delete operations with the presented scenario
Sample of Heirarchial grid with add, edit and delete operations with the presented scenario
Hi,
Could you please share with me a Sample of Hierarchical grid with add, edit and delete operations that handles a case like the below presented heirarchy?
Teams under various groups
[Group data type] Unit 1 description ...
[Group data type] -Production description ...
[Team data type] Management Team
[Team data type] Engineering Team
[Group data type] PClass A description ...
[Team data type] Team 1 Member count
[Team data type] Team 2 Member count
[Group data type] PClass B description ...
[Group data type] PClass C description ...
[Group data type] Sales description ...
[Team data type] Team 1 Member count
[Team data type] Team 2
>Unit 2
- Production
Sales
Class A
Class B
Class C
SIGN IN To post a reply.
3 Replies
MS
Manivel Sellamuthu
Syncfusion Team
May 11, 2020 11:42 AM UTC
Hi John,
Greetings from Syncfusion support.
From your query we suspect that you want a sample with hierarchy Grid with Crud actions handled. Based on that we have prepared a sample with remote data. Please find the below code example and sample for more information.
|
@{
var data = new Syncfusion.EJ2.DataManager()
{
Url = "/Home/UrlDatasourceChild",
InsertUrl = "/Home/InsertChild",
UpdateUrl = "/Home/UpdateChild",
RemoveUrl = "/Home/RemoveChild",
Adaptor = "UrlAdaptor",
};
var ChildGrid = new Syncfusion.EJ2.Grids.Grid()
{
DataSource = data,
QueryString = "EmployeeID",
ActionBegin = "actionBeginChild",
EditSettings = new Syncfusion.EJ2.Grids.GridEditSettings() { AllowAdding = true, AllowEditing = true, AllowDeleting = true },
Toolbar = new List<string>() { "Add", "Edit", "Delete", "Update" },
Columns = new List<Syncfusion.EJ2.Grids.GridColumn> {
new Syncfusion.EJ2.Grids.GridColumn(){ Field="UnitID", IsPrimaryKey=true, HeaderText="Unit ID", Width="150" },
new Syncfusion.EJ2.Grids.GridColumn(){ Field="ShipName", HeaderText="Ship Name", Width="150" },
new Syncfusion.EJ2.Grids.GridColumn(){ Field="ShipAddress", HeaderText="Ship Address", Width="120" },
new Syncfusion.EJ2.Grids.GridColumn(){ Field="N1", HeaderText="N1", Width="150" },
}
};
}
<div class="control-section">
<ejs-grid id="Grid" childGrid="ChildGrid" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Normal"></e-grid-editSettings>
<e-data-manager url="/Home/UrlDatasource" insertUrl="/Home/Insert" updateUrl="/Home/Update" removeUrl="/Home/Remove" adaptor="UrlAdaptor"></e-data-manager>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="125"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer Name" width="120"></e-grid-column>
<e-grid-column field="Freight" headerText="Freight" format="C0" width="170"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div>
<script>
function actionBeginChild(args) {
if (args.requestType === "add") {
// `parentKeyFieldValue` refers to the queryString field value of the parent record.
args.data.EmployeeID = this.parentDetails.parentKeyFieldValue;
}
}
</script> |
Snapshot:
Please let us know, if you need further assistance.
Regards,
Manivel
JS
John Stephen Mangam
June 3, 2020 06:35 AM UTC
Hi Manivel,
Thank you for the solution. It doesn't solve my problem yet.
Thank you for the solution. It doesn't solve my problem yet.
Hierarchical grid to show group and team data:
Group
- List<Team> Child Teams
- List<Group> Child groups
So I should be able to show the structure of the attached file in the grid with add, update, delete for both the Group and Team types heirarchially.
MS
Manivel Sellamuthu
Syncfusion Team
June 4, 2020 10:30 AM UTC
Hi John,
Thanks for your update.
From your query, we are unable to get your exact requirement. But we suspect that you want to Group the main Grid, and show the Child grid in the grouped row. If so you can achieve this requirement by enable grouping by setting allowGrouping="true".
Screenshot:
If the above screenshot is not the layout you want to show the data, please share the video demonstration or screenshot of the layout. So we can validate the possibility to achieve the requirement and provide a suggestion as soon as possible.
Regards,
Manivel
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
JS John Stephen Mangam
- May 9, 2020 06:34 AM UTC
- Jun 4, 2020 10:30 AM UTC