Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

How to display text inside the column cell?

subash asked on September 2, 2015

means need to show the grid withe values with text. please see the screenshot…

Attachments:
tester.png

6 answers

Public
Ian Sadovy Flexmonster September 2, 2015

Hello Subash,
 
Thank you for the question.
It is not possible to show text in the cells, because those values are aggregated (and there is no way to aggregate text values).
But, please take a look at the Flat Table demo, maybe it will suit your needs.
 
Best regards,
Ian

Public
Rodrigo February 21, 2020

Hi,
I have the same scenario described by subash. Since this was asked in 2015, I am writing now to know if something has changed. The problem of the flat table is we loose the grouping, which is the great feature I guess. Just wondering if there is any “hack” (this could be tip for future releases) to use the sum or any operator in formula and concatenate strings. Just in case I am attaching a model for what I wanted to achieve.
 
Thank you,
Rodrigo

Attachments:
model Table.png

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster February 21, 2020

Hello, Rodrigo,
 
Thank you for reaching out to us.
 
We would like to kindly inform you that only count and distinct count are available for the string data type.
 
However, as a workaround we suggest using the customizeCell API call in order to achieve the desired functionality. For example, an approach for your case can be similar to the following:

  1. Specify the hierarchy named “Description” and place any value in it. The data type can be both string or number. The hierarchy is going to be used as a wrapper for an actual description.
    {
    "Agent": "Agent B",
    "State": "VIC",
    ...
    "Description": ''
    },
    {
    "Agent": "Agent A",
    "State": "VIC",
    ...
    "Description": ''
    }
  2. Also, add another property named “Description Text” and place the desired description of the record in it:
    {
    	"Agent": "Agent B",
    	"State": "VIC",
    	...
    	"Description": '',
    	"Description Text": "The desired text"
    },
    
  3. Specify the data type of the hierarchy “Description Text” as property. This will hide the field from the Field List. Also, the hierarchy property has to be set to the name of the hierarchy the description is about. Data types should be specified using the mapping property of the dataSource object. The structure has to be similar to the following:
    mapping: {
        Agent: {
            type: "string"
        },
        State: {
            type: "string"
        },
        ...
        "Description Text": {
            type: "property",
            hierarchy: "Airline"
        }
    }
    
  4. Adjust the customizeCell method so it replaces the cell’s inner text with an appropriate description. E.g.:
    flexmonster.customizeCell(function customizeCellFunction(cell, data) {
        if (data.measure && data.type != 'header' && data.measure.uniqueName == "Description") {
            for (let elem of data.rows) {
                if (elem.hierarchyName == "Airline")
                    cell.text = elem.properties["Description Text"];
            }
        }
     });
    

Please check out an example we have prepared for you.
More information about customizeCell API provided by Flexmonster can be found following the link: customizeCell method.
Detailed description of the mapping object: Mapping Object.
Manual on using JSON data types: Data Types in JSON.
 
We hope it works for you.
 
Do not hesitate to contact us in case of any additional questions on this point.
 
Best regards,
Illia

Public
Rodrigo February 22, 2020

Hi Illia,
Thanks for your reply. I made a small test in my project and worked to display text, but apparently it lost the sum aggregation. Even seeing in the fiddle example, the other columns (“2020 Sales TTV” and “2019 Sales TTV”) are now counting, even though the measure is saying to sum. Is there anything I am missing?
Just another thing I want to clarify as well: whenever you use the mapping object, you need to provide everything you have on measures right? I am saying that because my project is under React and the measures I have them inside state, because I was changing according to the user dynamically.
When I tested your example, I was getting error in the console, but then I tested deleting measures not mapped and worked (just the problem now with the counting rather than sum). So, if I provide the mapping, has to be everything I might have as measures, right? 

Sorry to bother and thank you once again,
 
Rodrigo

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster February 24, 2020

Hello, Rodrigo,
 
Thank you for reaching out to us.
 
As for aggregation of the columns “2020 Sales TTV” and “2019 Sales TTV”, the reason for such behavior was incorrect type definition in the mapping object. We have modified an example so it displays the correct information with all required aggregations available.
 
Talking about the mapping object, you are right about the fact that all hierarchies and measures from the data set have to be at least mentioned in it. In case some hierarchies are missed in the mapping object, they will be ignored by the component and do not appear in the Field List. However, we recommend specifying the type of hierarchy in order to avoid unexpected results due to automatic type recognition.
 
We hope it helps.
 
Do not hesitate to contact us in case additional questions on this point occur.
 
Best regards,
Illia

Public
Rodrigo February 27, 2020

Hi Illia,
Thank you very much.

Please login or Register to Submit Answer