We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Hierarchy Grid and DataSources

HI,
just a question regarding the HIerarchy Grid and DataSources.
I need to reload dinamically the data binded on a sub level of my Hierarchical Grid, on demand.
Where in the Model can I change the sublevel Data and change them (possibly without reloading the Grid and Refreshing COntant that cloases all the levels opened?
When I open a Details Row, it's datasource contains only the data associated with that portion of the grid, and not the Entire Level Data that is defined on the ChildGrid MVC Helper.

I make an example: When I edit some values on a fourth level of my grid I need to recalculate the values present on the second.
i can change directly the json data loaded on the datasource or reload the data from the server and set as datasource of the second level

   Thanks in advance

    Andrea Perazzolo

1 Reply

AS Alan Sangeeth S Syncfusion Team March 13, 2015 11:02 AM UTC

Hi Andrea,

Thanks for using Syncfusion Products.

We are glad to let you know that your requirement(“While editing in child grid update parent record also without collapsing the child Grid”) can be achieved by updating the parent Grid record using “updateRecord” Grid method in the “endEdit” event of child Grid. Please refer the following code snippets

@(Html.EJ().Grid<object>("HierarchyGrid")

....

.ChildGrid(child =>

        { ...

.ClientSideEvents(eve => eve.EndEdit("edit"));

    })

        )

function edit(args) {

        var obj = $("#HierarchyGrid").ejGrid("instance")

        var tr = this.element.closest("tr").prev("tr");

        var index = obj.getIndexByRow(tr);

        var rec = obj.model.currentViewData[index]

      

        this.refreshContent();

        var count = this.model.dataSource.filter(function (e) { if (e.Verified && e.EmployeeID == args.data.EmployeeID) return e }).length;

        rec.TrueCount = count;

        obj.updateRecord("EmployeeID", rec);

    }

For your convenience we have created a sample and the same can be downloaded from below link.

Sample: http://www.syncfusion.com/downloads/support/directtrac/118488/EJGrid1444397340.zip

In the above sample, in parent Grid we have a column that holds the count of true values in child Grid Column. When we edit the Boolean column in Child Grid we have updated the parent Record.

Also while creating the sample we faced issues “On updating Parent Grid record, its expand icon changes to Collapse icon” & “Total record count issue with updating record in child record”. We have logged defect report for this issue. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

But as workaround we have resolve this issue in the above sample by manually changing the collapse icon to expand and calling “refreshContent” Method. Please refer the following code snippets.

function edit(args) {

this.refreshContent();

        obj.updateRecord("EmployeeID", rec); // To resolve total record issue in child Grid

        tr = this.element.closest("tr").prev("tr");

        tr.find(".e-detailrowcollapse").attr("class", "e-detailrowexpand");

        tr.find(".e-gnextforward").attr("class", "e-icon e-gdiagonalnext");

    }

Please let us know if you need any further assistance.

Regards,
Alan Sangeeth S



Loader.
Live Chat Icon For mobile
Up arrow icon