Get Free Trial
Get Free Trial

Send optional custom parameter to customizeCell function

Julien PULEO asked on March 20, 2018

Hi,
I’ve got the specific cells format in json object and I would like to apply it in customizeCell function.
Is it possible to send optional parameter to this function ?
B.Regards
Julien Puleo

5 answers

Public
Dmytro Zvazhii Flexmonster March 20, 2018

Hello Julien,
Thank you for your question. The customizeCell function does not allow sending additional custom parameters. Still, could you please give us some more information about your use case? It will be much easier for our dev team to find an appropriate solution.
Waiting for the update from you.
Regards,
Dmytro

Public
Julien PULEO April 11, 2018

Hello Dmytro,
My case is easy, I’ve got in object all information about, background color, color, font, etc… for total and subtotal, and I would like to access of my object in customizeCell to use and apply it.
Waiting for the update from you.
Regards
Julien

Public
Tanya Gryshko Flexmonster April 11, 2018

Hello, Julien,
Thanks for specifying the details of your case.
We can suggest you the following approach:
1. Add certain CSS classes to subtotal and total cells in customizeCellFunction.
2. Define these CSS classes elsewhere in your code using the information from JSON object with the specific cells format.
Please check this sample: https://jsfiddle.net/flexmonster/Lmx4p4os/
Here customizeCellFunction adds three CSS classes:

function customizeCellFunction(cell, data) {
if (data.isClassicTotalRow) cell.addClass("fm-total-classic-r");
if (data.isGrandTotalRow) cell.addClass("fm-grand-total-r");
if (data.isGrandTotalColumn) cell.addClass("fm-grand-total-c");
}

These CSS classes are defined directly in CSS box and you can add them dynamically.
Please let me know if you have further questions.
Regards,
Tanya

Public
Julien PULEO February 19, 2019

Hello,
Thanks for your answer but it’s not exactly what I need because I don’t have my scope context in customizeCellFunction and I don’t know if I must apply style.
it’s not possible to wrap customizeCellFunction  to send another context in parameter ?

Public
Dmytro Zvazhii Flexmonster February 19, 2019

Hello Julien,
Thank you for your feedback.
You can make the context available by using ES6 syntax. Here is an example: https://jsfiddle.net/flexmonster/Lmx4p4os/57/.
The alternative approach is to bind the context explicitly by using js .bind() method.
Please let us know if you managed to resolve the issue.
Regards,
Dmytro

Please login or Register to Submit Answer