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

Reset Summary from ejGrid


I have been looking forward to see if there was any solution to my issue, however I didn't find any.
My problem is the following, I have an ejGrid which has a column that is a quantity. I Could use summaryType: ej.Grid.SummaryType.Custom or summaryType: ej.Grid.SummaryType.Sum.
Both worked fine to perform the sum. However I've a button which clears all form data, included the ejGrid data source, but the summary stays with the last resulted value.

Can Anyone help me to solve this?

Code below

Custom Function
function CarQuantity() {
        var gridObj = $("#GridCarTypes").ejGrid("instance")
        var qtCar = 0;
        var Quantity = "Quantidade"
        for (var i = 0; i < gridObj.model.dataSource.length; i = i + 1) {
            qtCar = parseInt(qtCar) + parseInt(gridObj.model.dataSource[i].QUANTITY);
        return (qtCar);

to clear the grid
   $("#GridCarTypes").ejGrid("option", { dataSource: [] });
        var instance = $("#GridCarTypes").ejGrid("instance");
        instance._filterCollection = [];
        instance._currentJsonData = [];

1 Reply

AS Alan Sangeeth S Syncfusion Team June 18, 2015 06:55 AM UTC

Hi Bruno,

Thanks for using Syncfusion products.

We have analyzed your code snippets and found that you have updated Grid datasource through Grid option method which was the cause of the issue.

We have provided Grid method “dataSource” for updating Grid datasource and we suggest you to use the dataSource Grid method to resolve the issue. Please refer the following code snippets.

$("#GridCarTypes").ejGrid("dataSource", []);

Please let us know if you need any further assistance.

Alan Sangeeth S

Live Chat Icon For mobile
Up arrow icon