Get Free Trial
Get Free Trial

Add new value to separators in Format > Format cells

Answered
Rodion Lezhnyuk asked on November 21, 2019

I need to use decimal, thousand separator that are not supported by default, e.g. ‘ | ‘, I set it via property formats when create FlexMonster object, but these separator values don’t appear in ‘Format cells’ inputs.
How to add new values for separators in ‘Format cells’ inputs and let user choose between values not supported by default, cause now, when I set custom separator, inputs become empty and immutable?

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster November 22, 2019

Hello, Rodion,
 
Thank you for your question.
 
In order to add custom thousand and decimal separators, Toolbar needs to be modified.
You can find its source code inside the folder named toolbar in your package. The dropdowns with symbols are adjusted right below // thousand_separator and // decimal_separator comments.
The desired symbol has to be added as an element of an appropriate array.
For example, the | symbol can be added using the following code:

thousandsSepDropDown.options[n] = new Option("|", "|");

* n defines position of a new symbol inside the dropdown list.
 
You can learn more about Toolbar customization by the link: customizing toolbar.
 
We sure hope it helps.
 
You are welcome to contact us in case of additional questions appear.
 
Kind Regards,
Illia

Public
Rodion Lezhnyuk November 22, 2019

Hi Illia, We use npm to install FlexMonster package, so everytime we’ll update version this change will have to be added again Is there any other way to do it?

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster November 22, 2019

Hello, Rodion,
 
The required functionality can be saved after update by overriding the necessary method of the original Toolbar.
 
Our team kindly suggest you following steps below:

  1. When including Flexmonster in your project, use flexmonster.full.js instead of flexmonster.js.
  2. Add a link to the flexmonster.css file inside the <head> tag.
  3. Copy the flexmonster.toolbar.js file to the directory you want it to be placed in.
  4. Change it in the appropriate way and delete methods that are not modified. In your case, the only method you need to leave is the FlexmonsterToolbar.prototype.showFormatCellsDialog method.
  5. Indicate the path to the new file right after flexmonster.full.js is connected:
    <script type="text/javascript" src="path/flexmonster.full.js"></script>
    <script type="text/javascript" src="path/customFlexmonster.toolbar.js"></script>

 
We sure hope it helps.
 
Best Regards,
Illia

Please login or Register to Submit Answer