Issue with interop process between C# and JavaScript

Answered
Mark asked on November 27, 2023

Good day,

I have received a message from one of our developers regarding integrating the FlexMonster Pivot table with our C# client. Essentially, we are attempting to create a custom column. Here is their message to me:

I've been working on adding the new column to our default view. Actually, adding the column and setting up its formula was a breeze, but I've run into a roadblock on setting its default formatting. Flexmonster has a fairly intuitive way of doing this, namely that the "Report" object, which is main configuration for the table, has a "Formats" array, and then each column provides a string key into that array. The following code provides an example from JSFiddle that performs the formatting that I want to apply.

let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
"dataSource": {
"filename": "data/data.csv"
},
"slice": {
"reportFilters": [{
"uniqueName": "Business Type",
"sort": "asc"
},
{
"uniqueName": "Destination",
"sort": "asc"
}
],
"rows": [{
"uniqueName": "Country",
"sort": "asc"
}, {
"uniqueName": "Color",
"sort": "asc"
}],
"columns": [{
"uniqueName": "Category",
"sort": "asc"
}, {
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum",
"format": "percentage"
}, {
"uniqueName": "Quantity",
"aggregation": "sum"
}]
},
"formats": [
{
"name": "percentage",
"isPercent": true
}
]
}

To that end, I attempted to add such formatting to our default report:
 
Formats = new Format[]
                {
                    new Format()
                    {
                          Name = "percentage",
                          ThousandsSeparator = "",
                          DecimalSeparator = "",
                          DecimalPlaces = 0,
                          MaxDecimalPlaces = 0,
                          MaxSymbols = 0,
                          NegativeNumberFormat = "",
                          CurrencySymbol = "",
                          PositiveCurrencyFormat = "",
                          NegativeCurrencyFormat = "",
                          IsPercent = true,
                          NullValue = "",
                          InfinityValue = "",
                          DivideByZeroValue = "",
                          TextAlign = "",
                          BeautifyFloatingPoint = true
                    }
                }
});
Here I've added the other fields which are allowed on the Format object, but the operative line is in bold in the center: isPercent = true.
 
However, when the report loads in the Dispatch Tool, that formatting is not respected. Moreover, by saving the report (I re-enabled that control just for this test), I could see what the actual state of the table was:
 
    "formats": [
        {
            "name": "percentage",
            "thousandsSeparator": "",
            "decimalSeparator": "",
            "decimalPlaces": 0,
            "maxDecimalPlaces": 0,
            "currencySymbol": "",
            "negativeCurrencyFormat": "",
            "negativeNumberFormat": ""
        }
    ],
 
As you can see, most of the fields that I tried to set did not get passed into the JSON that actually loads in the page. Most importantly, the isPercent value is not present here. Note, however, that the other values present here are respecting the settings that I put in the C# code (for example, the default value of decimalSeparator is '.', while it is an empty string here.
 
Overall, it looks like the Flexmonster table is not properly setting all of the fields of the Format object based on the initialization in the C# code. This test was performed with Flexmonster 2.9.64 as well.

2 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster November 28, 2023

Hello,

Thank you for reporting the issue.

We will take a look at the described behavior and provide a fix with our minor release with the ETA December 26th. Our team will notify you about the release.

Feel free to contact us in case other questions arise.

Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster December 26, 2023

Hello Mark,

We are glad to inform you that the issue with the Format object configurations not being applied to a report was fixed.

This fix is available in the 2.9.67 version of Flexmonster: https://www.flexmonster.com/release-notes/version-2-9-67/

You are welcome to update the component. Here is our updating guide for assistance: https://www.flexmonster.com/doc/updating-to-the-latest-version/

Please let us know if the fix works. Looking forward to hearing from you.

Kind regards,
Nadia

Please login or Register to Submit Answer