We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Saving a field display setting

Answered
Volodymyr asked on June 3, 2022

Good afternoon! Please tell me how I can save the display settings for specific fields (make a stencil) when loading a report. For example, a report with 20 columns arrives at the frontend, I configure 10 of them to be displayed in a certain order and I want to save this setting. Thanks in advance!

3 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 6, 2022

Hello, Volodymyr!
 
Thank you for contacting us.
 
We kindly suggest two ways to save fields in custom order:
 
1. Automatically generate all configurations of the current grid. Firstly, make all necessary changes on the grid using Flexmonster UI. These settings are stored in the report, which can be retrieved in two ways:

  • by saving the report as a local file by clicking the Save button in the toolbar. The resulted report.json file will contain all fields in customized order and can be used as a template. For that, simply open the report file in a text editor(e.g., Notebook or Notepad) and copy configured sliceObject into your project.
  • by using the getReport() API call, which returns a report as a js object. Please, check out our docs for the detailed structure of the reportObject: https://www.flexmonster.com/api/report-object/

 
2. Manually set the order for required fields in code. For json, csv, and api data sources, the order of columns in flat form can be defined with the flatOrder property of the sliceObject:

"slice": {
   "flatOrder": [
      "SupplierName",
      "Depo",
      "ArticleNumber",
      "NumRoc",
      "OrderNumber"
      ...
   ],
}

The fields which are not included in this array would be ordered in the way they are specified in the rows, columns, and measures properties of the sliceObject.
 
We have prepared a jsFiddle example for visualization: https://jsfiddle.net/flexmonster/ct51b3gk/.
 
You can find the detailed structure of the sliceObject in our docs: https://www.flexmonster.com/api/slice-object/.
 
Hope it helps. Feel free to contact us in case of any other questions.
 
Regards,
Solomiia

Public
Volodymyr June 8, 2022

Thank you very much for the explanation, you helped a lot!) In fact, everything turned out to be simple)

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 8, 2022

Hello, Volodymyr!

Thank you for your response.

We are glad to hear that our solution was helpful.

You are welcome to contact us in case of any other questions.

Regards,
Solomiia

Please login or Register to Submit Answer