How can I change column headers in tables/pivot tables in icCube reporting v6? - iccube

Is it possible to change the column headers of tables/pivot tables? By default they are named as the hierarchy/measure.

You can use icCube Table's Cell Renderers to do that.
Cell renderers is a powerful feature of icCube tables, that provides a bunch of opportunities to configure look & feel of your tables.
It can be found under "Data Render Options" category of widget options.
Several Cell Renderers
If you have static order of columns in your table you can create cell renderers for each column bound by it's index:
First column:
Second column:
One Cell Renderer / Javascript Way
This is a dynamic solution and doesn't depend on columns order.
You might want to use "Top Header Text" field to overwrite header label as shown in the picture below:
In this case I've created an alias for header labels with this peace of javascript code:
This solution an code could be expanded to handle as many columns as you need.
P.S.
"Top Header Text" field's expression value suitable for your case:
var header = context.columnLabel()
switch(header){
case 'formatted_date_hierarchy': return 'Date';
case 'product_hierarchy': return 'Product';
default: return header;
}
UPDATE
Here is a Demo Report with first solution.

Related

Vaadin 14 Grid Component Column containing checkbox does not sort

I am using Vaadin 14 grid. This grid contains a number of columns. A few of them need to represent boolean values, hence we use a checkbox component inside that column. This is done by using grid.addComponentColumn method. The text related columns a just added using grid.addColumn
Now we want to enable multisort on the grid. By default the sorting indicators (up/down arrow) in the header are shown for the text based columns but not for the boolean values .
After adding sorting to the boolean column /component column (addComponentColumn(...).setSortable(true) the sorting indicators in the headers are shown, but the sorting itself is not performed when changing the sort direction (none / asc / desc) using the arrows in the header.
How can I make this work?
Thanks in advance!
When you have custom logic for what's rendering in a column, then you also need to explicitly configure how sorting should be handled for that column.
If you're using in-memory data, then you do that using Column.setComparator. If you're using a backend data source, then you should instead use Column.setSortProperty and also ensure that the data provider actually considers the contents of Query.getSortOrders.
You can see an example of this in practice at https://cookbook.vaadin.com/sort-with-renderer.

custom rows in react-admin list view

I am using the react-admin list component and want to add a custom layout for specific rows.
Usually, each row is build by the list component using the data from the data-provider. I would like to customize specific rows based on the data of the row. These specific rows should not use the standard layout (and columns), but a specially defined one.
Here is a example, what I am looking for:
The special rows should be selected according to the data object.
Standard data object, which forms a standard row, may look like:
{
id: 127,
Reference: "OEPEE4",
author_id: 12,
...
}
The special entry may look like:
{
id: 128,
isSpecial: true,
text: "Lorem Ipsum ...",
...
}
Does anyone know how to achieve this?
Thanks!
I think the key lies in creating your custom DataGrid component's body and rows, because that way you would be able to check the value of record.isSpecial, as the record is passed to the component. Take a look at this part of the docs.
I tried playing around a bit with a custom DataGridRow (here's the sandbox), and I was able to display only the text when the record has the isSpecial property, although I think you would need to style the cells and the row. Maybe you get some ideas from it. Let me know if it helps.

How to find object with Missing label?

I have a requirement where I need to create a list of all missing labels in any particular object.
For example.
I want to create a new table with a couple of fields and an overridden method. Now, suppose I am setting up the table property label as "Car details" similarly I am creating new fields and setting their label properties as "Car" and "Model" respectively and overriding validateWrite method with the error "Car-model combination not valid". But, I am not creating a label for any one of them. So now I want to write a job which will show that I need to create three missing labels.
I know Best practice check will give me warnings for the above scenario but I need it as a list as I'll use this list to enhance the Label editor.
Thanks in advance.
You could loop through the AOT using the TreeNode class and select elements where the label property is blank. Then you can send the information out to the infolog or whatever you wish.
There are numerous code examples out there of how to do that, such as this one looping over forms selecting on the HTMLHelpTopic property.

how to Change the text color of one column on datagrid when user enters data on other column

I had a very simple problem that, I had a spark datagrid of 3 columns in which 2 columns will be with data and the third column is an empty column with text input as itemeditor. So what ever the data user enters in the cells of third column should always verify with the first column and the appropriate first column value or text should turn into red. This is because user should not enter the duplicate value.So,somebody please help me. Thanks!
I am using Advanced datagrid instead of spark, in Advanced datagrid, you can do this by using the styleFunction="myStyleFunction" of a data grid or a single column.
code sample:
public function myStyleFunc(data:Object, col:AdvancedDataGridColumn):Object
{
// all rows for invalid selection combinations
if ((data["isRequired"]) && !(data["isSelected"]))
return {color:0xFF0000, fontWeight:"bold", backgroundColor:0xf2d6d7};
// Return null if the selection is valid
return null;
}
For coloring in datagrid column for best practice use itemrenderer there you can easily show color for background and foreground.
In case of text color in datagrid use this setStyle. e.g.
labelDisplay.setStyle("color",0xFFFFFF);
labelDisplay is the id of your Label inside itemrenderer.

VFP Grid with multiselect

I'm trying to implement multiple record selection feature on a grid.
It is very similar to http://www.tek-tips.com/faqs.cfm?fid=3831
It adds an extra column with check boxes. I want those check boxes!!
But it depends on a extra logical field in the underlying table. It need to create a class clscheck which inherits CHECKBOX. I'm not sure why this CLICK procedure is needed for the checkbox.
PROCEDURE CLICK
IF DODEFAULT()
KEYBOARD '{DNARROW}'
ENDIF
ENDPROC
When I removed it, row selection did not work correctly as expected. Why this?
Here is my requirement:
1) I don't want to add an extra logical field in the underlying table.
2) To work with controls in the grid, I think AllowCellSelection must be .T. I want AllowCellSelection = .F. because I don't need to work with any control in the grid except the check boxes. I need to work only with check boxes. The other columns will be read-only.
3) Can I have selected list without the logical field in the underlying table?
4) Can I remove the usage of KEYBOARD '{DNARROW}'?
In fact, I have a grid which is AllowCellSelection = .F., but it only provides single selection.
I need to enhance it with multiple selection, thus, I just want to add an extra column with check boxes so that user can know he can select multiple records.
No need Shift+Click or Ctrl+Click which is not familiar with idiot users.
I have found this - http://www.tek-tips.com/faqs.cfm?fid=433
It also depends on an extra logical field and it depends Shift+Click and Ctrl+Click.
What you are seeing is quite common for multi-select grids. I've used them SIMILAR to this in the past. However, you are afraid of the extra column in the underlying table. That may/not be true. You don't always have to update the ORIGINAL table, but a temporary CURSOR you are presenting to the user. Ex: If you want to display a list of employees in a table. No, you don't want to keep adding this column to the original employee table as then anyone else trying to do multi-select could falsely get your selection. However, if you pulled into your own local cursor and presented to the user, then no problem. Example...
Thisform.YourGrid.RecordSource = "Employees"
(bound directly to your employee table -- not necessarily the right thing)
vs
use in select( "C_MultiPickEmployees" )
select ;
.F. as IsChosen, ;
E.* ;
from ;
Employees E;
into ;
cursor C_MultiPickEmployees READWRITE
Thisform.YourGrid.RecordSource = "C_MultiPickEmployees"
NOW, you have your extra column without dealing with issues to the underlying table. If you wanted to further filter what you were showing -- such as employees for a certain division/department, then just add that to a WHERE clause, add an Order By if so needed and you are good to go.
As for the "Allow Cell Selection", I've never had to deal with that. I just add a "checkbox" to the first column and set
Thisform.YourGrid.Column[1].CurrentControl = "CheckBoxControl"
(based on the name it is added to the column).
Then, set the column 1's "ControlSource" = "C_MultiPickEmployees.IsChosen" and you should mostly be done.
As for the "CLICK" event trying to force the down arrow. This is more for automatically scrolling to the next record so you can just click, click, click for multiple entries.
Hope this helps clarify things for you.

Resources