We have updated Flexmonster Software License Agreement, effective as of September 30, 2025 (list of changes)

How to Make Certain Fields Required in Either Rows or Columns

Answered
taehong asked on September 30, 2025

I have a business requirement where certain fields with specific unique names must always be present in either rows or columns (at least in one of them). I'm looking for guidance on how to implement this validation.

 

Use Case:
We need to ensure that a specific field (e.g., a field with uniqueName "requiredField") is always displayed in the pivot table, either in rows or columns, and users should not be able to remove it completely from both areas.

 

Possible Approaches I'm Considering:

 

  1. Pre-configure and Lock Field Position:

    • Pre-set the required field in either rows or columns by default
    • Allow users to move it between rows and columns, but prevent complete removal
    • Make the field non-selectable/disabled in the Field List to prevent unchecking
  2. Validation on Field Removal:

    • Intercept when a field is being removed from rows/columns
    • Check if it's the last instance of the required field
    • Show an alert message and prevent the removal action
    • Restore the field to its previous position

 

Questions:

  1. Is there a built-in way to mark certain fields as "required" in the pivot configuration?
  2. Can we hook into events before a field is removed to validate and potentially cancel the action?
  3. Is it possible to disable/hide specific fields in the Field List while keeping them active in rows/columns?
  4. What would be the recommended approach to implement this requirement?

2 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster September 30, 2025

Hello, Taehong!

Thank you for your question.

Kindly note that it is not possible to prevent some fields from being removed from the slice using our built-in Field List control. For such use cases, we recommend creating your own Field List control.

Please find detailed answers to your questions below:

1) Is there a built-in way to mark certain fields as "required" in the pivot configuration?

In Flexmonster, it is not possible to set some fields as required out of the box.

2) Can we hook into events before a field is removed to validate and potentially cancel the action?

There are no Flexmonster events that are triggered on minor changes in the Field List. It is possible to use DOM events and observers to adjust the behavior of our built-in UI controls, but such low-level interventions are not recommended and may lead to unexpected behavior.

3) Is it possible to disable/hide specific fields in the Field List while keeping them active in rows/columns?

No, our component is designed to show all the fields in the Field List.

4) What would be the recommended approach to implement this requirement?

For the described use case, we recommend creating your own Field List control and using our events and API calls to apply all the changes to Flexmonster.

Here is the JSFiddle to illustrate the idea: https://jsfiddle.net/flexmonster/76r9cv0L/.

You can find the detailed instructions on creating a custom Field List control in the following guide: https://www.flexmonster.com/doc/creating-a-custom-ui-control-or-view/#creating-custom-field-list.
For your use case, we also suggest switching off dragging on the grid and updating the context menu, so users won't be able to remove the field by bypassing the Field List. Here is the example of how to remove the "Remove field" tab from the context menu: https://jsfiddle.net/flexmonster/gbuvksq3/.

Hope you will find our answer helpful. Don't hesitate to contact us if you need our further assistance with implementing a custom Field List control.

Kind regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster 1 day ago

Hello, Taehong!

Hope you are doing well.

Our team is wondering if you had some time to check our previous response about making some measures required in the Field List. Could you please let us know if the suggested approach of creating your own Field List control works well for you?

Looking forward to hearing from you.

Kind regards,
Solomiia

Please login or Register to Submit Answer