datastore group stack

Hi all,
is there a way to clear the datastore group stack? I called function group() twice
on datastore and I had to call ungroup() function twice to restore original data:



//outer group
g.data.group({
          by: function (obj) {
           return (obj.BANDESC == '' ? 'CASSA' : obj.BANDESC) + obj.PAGDESC;
          },
          map: {
           ENTRATE: ["ENTRATE", "sum"],
           USCITE: ["USCITE", "sum"],
           BANDESC: ["BANDESC"],
           PAGDESC: ["PAGDESC"]
          },
          row: function (o) {
           return "<span style='margin-left: 20px'><b>" + o.PAGDESC +
            "</b> Entrate: " + o.ENTRATE +
            " Uscite: " + o.USCITE +
            " <b>Saldo: " + webix.i18n.numberFormat(o.ENTRATE - o.USCITE) + "</b></span>";
          }
         });

//inner group
g.data.group({
          by: function (obj) {
           return (obj.BANDESC == '' ? 'CASSA' : obj.BANDESC);
          },
          map: {
           ENTRATE: ["ENTRATE", "sum"],
           USCITE: ["USCITE", "sum"],
           BANDESC: ["BANDESC"]
          },
          row: function (o) {
           return "<span style=''><b>" + (o.BANDESC == '' ? 'CASSA' : o.BANDESC) +
            "</b> Entrate: " + o.ENTRATE +
            " Uscite: " + o.USCITE +
            " <b>Saldo: " + webix.i18n.numberFormat(o.ENTRATE - o.USCITE) + "</b></span>";
          }
         });

         g.openAll();


and then


        g.data.ungroup();
        g.data.ungroup();

to reset to original data. Is there a better way ?
Thank you

Hello!
You can completely reload the data.
If the case is really hard, maybe it’s better to group the data on server-side instead of our features.
On the client - side there is no other solution. The point is that group it’s client-side operation which is fully change the structure of the loaded data. In addition, you can group only one level at a time.

Thanks. Yes I know I can reload the data but in this use case it’s expensive for me.