Author Topic: Refresh on cellSaveEvent  (Read 6173 times)

mercury85

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 58
  • ASP.NET, VB.NET, MVC, JS, C#, VBA, SQL, MDX, DAX
    • View Profile
Refresh on cellSaveEvent
« on: May 01, 2018, 06:49:06 pm »
Reviewing the cellSave event and also read through this forum post:  https://paramquery.com/forum/index.php?topic=469.0.  I attempted the refresh  and no luck :(  Now I will admit that I am doing some crazy things, with calculated columns.

(With 16 columns I am doing the following:

['c_6', function (rd) {
            return rd.Series == 'SomeSeries' ? rd.C_6 : undefined;
        }]

With these 16 columns, I am rendering the real value from 'C_6'
When I do an edit, and the edit is on 'c_6' I call

    function editParentRow(ui) {
        var newRow = ui.updateList[0].newRow;
        var rowIndex = ui.updateList[0].rowIndx;

        changeKeysToUpper(newRow);
        grid.updateRow({
            rowIndx: rowIndex,
            newRow: newRow,
            checkEditable: false
        });
    }

In order for this to work, I must have the uppercase of C_6, C_5, ... columns defined and hidden.  I added the summary columns, and repeated all the steps for my groupings as I did for my columns.  Now my calculations on the summary are concatenating my groupings and on these calculated columns,

On the event I execute the following and nothing occurs :(

    cellSave: function (evt, ui) {
            //need to refresh row, so col summaries update.
            this.refreshRow({rowIndx: ui.rowIndx});
        },




paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Refresh on cellSaveEvent
« Reply #1 on: May 01, 2018, 08:45:56 pm »
That's an old post based on render workaround when the js formulas were not present in grid API,

Please refer to the online demos for js formulas.

https://paramquery.com/pro/demos/grid_formula

and kindly share a jsfiddle/ plnkr of the issue faced by you if any.

mercury85

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 58
  • ASP.NET, VB.NET, MVC, JS, C#, VBA, SQL, MDX, DAX
    • View Profile
Re: Refresh on cellSaveEvent
« Reply #2 on: May 02, 2018, 08:10:40 am »
Hi, the calculated column continues to concatenate after call a rowrefresh.

Please see the following:

https://plnkr.co/Qh7g3x


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Refresh on cellSaveEvent
« Reply #3 on: May 02, 2018, 10:46:54 am »
Please recheck the url. It says, "not found".

mercury85

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 58
  • ASP.NET, VB.NET, MVC, JS, C#, VBA, SQL, MDX, DAX
    • View Profile
Re: Refresh on cellSaveEvent
« Reply #4 on: May 02, 2018, 11:09:58 am »
https://plnkr.co/omLtYp

How about now?  Strange, it is set to public.

mercury85

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 58
  • ASP.NET, VB.NET, MVC, JS, C#, VBA, SQL, MDX, DAX
    • View Profile
Re: Refresh on cellSaveEvent
« Reply #5 on: May 02, 2018, 11:28:24 am »
Just in case plunker is strange...


http://jsfiddle.net/mgregory85/76gmd73o/

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Refresh on cellSaveEvent
« Reply #6 on: May 02, 2018, 11:59:17 am »
thanks jsfiddle is opening fine.

I see there are many computed columns.

Quote
the calculated column continues to concatenate after call a rowrefresh.

Please mention steps in detail in reference to the jsfiddle. What are you expecting in which cell and what is the displayed value.
« Last Edit: May 02, 2018, 12:07:20 pm by paramquery »

mercury85

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 58
  • ASP.NET, VB.NET, MVC, JS, C#, VBA, SQL, MDX, DAX
    • View Profile
Re: Refresh on cellSaveEvent
« Reply #7 on: May 07, 2018, 11:37:14 pm »
I would imagine that if I enter entries, the total would reflect accordingly in the attachment.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Refresh on cellSaveEvent
« Reply #8 on: May 08, 2018, 09:39:04 am »
It appears incorrect because formulas act on cell data, not on rendered cell values.

Only formulas should be used to make computations based on other cell data, column render shouldn't be used for same purpose.

So you need to move all computations from column.render callbacks to formulas.

mercury85

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 58
  • ASP.NET, VB.NET, MVC, JS, C#, VBA, SQL, MDX, DAX
    • View Profile
Re: Refresh on cellSaveEvent
« Reply #9 on: May 08, 2018, 01:15:35 pm »
The reason I am doing the render is because I do not want the summary totals to include the Series "Famous Toys" in the roll up of period C_6, C_5, and C_4.  Do you know if this would be possible?  It is working as expected on the roll ups on the columns I am doing the render on for the summary totals.


I am basing this off your response on this other thread.  https://paramquery.com/forum/index.php?topic=2670.0


When I remove the render and pull the dataIndx from the formulas, the result is concatenating.

{
        title: "2015T",
        format: '##,###',
        width: 100,
        dataIndx: "P1Total",
        cls: 'lightblue',
        editable: false,
        render: function() {
          return {
            style: 'background-color: rgb(242, 248, 252); font-style:italic;font-weight: bold; color:black;  border: 1px solid #bbb;'
          };
        },
        summary: {
          type: "sum",
          edit: false
        },
       
      }
« Last Edit: May 08, 2018, 01:24:56 pm by mgregory85 »