Hi everyone,
I cannot believe that’s not supported, so here I am to ask: how the heck can I edit the diplay name of a calculated value? Let’s suppose I want to show two values in my pivot: max(temperature) and avg(temperature). They both refer to the field “temperature”. So, in the pivot UI, I want the first column to appear with label “Maximum Temperature”, and the second with “Average Temperature”. Cannot find where I can edit the name, the displayed name.
This scenario might look not useful, but think to a custom operator that I call like delta_perc. I want to show a value column that is the reuslt of that oiperator, and that operators gets two values as input. By now, the “visible” name of that column is something unreadable like “(col1, col2) operator”. Is it true that you’ve built a whole powerful pivot widget and you haven’t thought to provide a way to rename the visual column value title? Tell me that’s not the case.
Thanks
hi,
not sure about “proper” way to implement your scenario.
but there is a workaround.
check this
Hello @progettoautomazione,
The workround example above is a good solution, but we can offer a solution through customization: Code Snippet
The Pivot and most of our complex widgets (except Kanban and Spreadsheet) are built as modularized apps on Webix Jet, and the user can customize existing modules or add new ones.
Modules are implemented as JetViews (ES6 classes) where any UI element, data-related service, or feature can be customized by the same rules. For more details about this architecture, please check the following blog article, which describes the general idea and reasons for this structure.
Please note that complex modifications may require observing the source code of the tool in order to build the most feasible solution that will correctly alter/extend the original logic.
In order to customize the column template, you need to use view customization. First, using the Class Map, we determine that we need to customize the “table” view. Inside this view’s source code we find a function responsible for operation templates - OperationTemplate(). Based on this, we create a custom class (for example, MyTable) as follows:
class MyTable extends pivot.views["table"] {
OperationTemplate(operation, fields, math, _) {
//custom logic goes here..
}
}
Since the operation template directly depends on the type of operation, it is necessary to add a new property for the template (this can be done by customizing the view “main”). And based on the value of the new property, draw the desired template. In the same customization you can change the order of the templates of operations and fields.
As for fields, the names of their templates can be specified through the fields property (field value
).
We can also offer a second customization option: Code Snippet. The difference is that here a property for the header is created and the template is converted through it. Also, in such customization, you can not set fields, but transform field templates indirectly through customization (in the example fields are used).
We will consider simplifying this process as a future request, thank you!
Thanks very very much!
Thanks very much, yeah it’s definitely far from being user-friendly, but I’ll play with this how to! Thanks!