Search code examples
sortingag-gridstimulsoft

ag-grid sorting is not working with another third party plugin


ag-grid sorting is not working with another third party plugin. Stimulsoft report.js for reporting tool.

please find plunkr link for the same.

<html>
<head>
      <script src="https://unpkg.com/[email protected]/dist/ag-grid.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/[email protected]/stimulsoft.reports.js"></script>

 </head>
 <body>

<div id="myGrid" style="height: 100%;" class="ag-fresh"></div>
<script src="main.js"></script>

</body>
</html>    

Solution

  • in ag-grid

          ComponentUtil.toNumber = function(value) {
                if (typeof value === 'number') {
                    return value;
                } else if (typeof value === 'string') {
                    return Number(value);
                } else {
                    return undefined;
                }
            }
    

    and in stimulsoft

    Object.prototype.toNumber = function() {
       if (this.sti_is(String) && this.indexOf(",") >= 0)
          return Number(this.replaceAll(",", "."));
       return Number(this)
    }
    

    so due to this conflict sorting is not able to do.

    then i added below lines then solved my issue.

    <script>
         Object.prototype.toNumber = undefined;
    </script>