onBeforeRender event is not working in Pivot view. I need to change the value with decimalsize 0 on before render. currently i am using webix version 9.4.0

onBeforeRender event is not working in Pivot view. I need to change the value with decimalsize 0 on before render. currently i am using webix version 9.4.0

Good day @GOKULAKANNAN_R ,
From version 9.0 the Pivot has been rewritten on Webix Jet for easier customization. So, now there are its own peculiarities when working with it.
To change the values of the cells, you have to customize the pivot a bit.
To do this, you need to:

  1. extend the existing pivot’s view or service with your own class where you can change the logic as you wish. For example, you may override one of the view’s methods.
  2. on the component’s init in the override property you need to specify the view / service that should be rewritten to the class created by you earlier.

So, to change the format of the numbers, for instance, you need to override the method CellFormat(value) of the pivot’s “table” view.
Please, check the example: Code Snippet .

1 Like

Thank you so much @MariyaDemy. Its working fine :star_struck:

@MariyaDemy I am having another issue, I need to sort the values in ASC order. I am using Pivot table and not having columns information in the structure. can you please help me on this!! :confused:

@GOKULAKANNAN_R ,
In the same table view, there is an UpdateTable(data) method. To sort the initial values you could sort the data after it has been parsed there.
At the same time, it is important to save the all default logic. So, you should inherit it with the super() just like you would do in an ordinary JavaScript class: super.UpdateTable(data); and then sort() the data.
The first parameter for sort() can be taken from the data object that UpdateTable(data) receives.
Please, check the example: Code Snippet .

Hi @MariyaDemy Thanks for your answer. I have used following below peace of code to sort in Asc order.
scheme:{
$sort:function(objA, objB)
{
return objA[2] > objB[2] ? 1 : -1;
}
}
:blush: I have tried with your solution too and its worrking fine…

@MariyaDemy Hi Mariya… I have enabled totalcolumn option in the pivot configuration and its working fine with single column. When i try to add multiple columns, the total column values are not working properly. some of the total column values were misplaced in other cell.

Good day @GOKULAKANNAN_R ,
Could you share your pivot’s configuration example (code snippet) ? Unfortunately, I didn’t managed to reproduce the described issue.