225
Views
2
Comments
Solved
[OutSystems Data Grid] How to restrict the negative values in number column
outsystems-data-grid
Reactive icon
Forge asset by OutSystems

Hello Community,

Good Morning!!

We are trying to restrict the entry of negative values in a grid number column, So kindly help me with your suggestion.


Thanks & Regards,


2021-03-18 21-03-15
Benjith Sam
 
MVP
Solution

Hi Gollavilli, 

For your use-case, one of the work-around solutions would be to set the Number Column min value to 0

Implementation Steps:

  • Define the Grid OnInitiazlie event handler
  • In the OnInitiazlie event handler action flow execute the below mentioned JS to set the min value to 0 

JavaScript Snippet:

var grid = GridAPI.GridManager.GetGridById($parameters.GridWidgetId);

grid.getColumn($parameters.Binding)._configs.getProviderConfig().editor._min = 0;

Refer to the attached oml solution.

Demo Screen: DG_OnlyPositiveNumber

I hope this helps you!


Kind regards,

Benjith Sam

RWA_Lab_DG_OnlyPositiveNumber.oml
2020-11-25 10-45-32
Mostafa Othman
Champion

Hello Gollavilli,

If it a user input so you can do validation first before saving data. you can check below URL for form and input fields validation then you can apply your own logic for validation (for example Rate > 0) and set validation message for field

https://success.outsystems.com/Documentation/11/Developing_an_Application/Design_UI/Forms/Validate_the_fields_of_a_form


2021-03-18 21-03-15
Benjith Sam
 
MVP
Solution

Hi Gollavilli, 

For your use-case, one of the work-around solutions would be to set the Number Column min value to 0

Implementation Steps:

  • Define the Grid OnInitiazlie event handler
  • In the OnInitiazlie event handler action flow execute the below mentioned JS to set the min value to 0 

JavaScript Snippet:

var grid = GridAPI.GridManager.GetGridById($parameters.GridWidgetId);

grid.getColumn($parameters.Binding)._configs.getProviderConfig().editor._min = 0;

Refer to the attached oml solution.

Demo Screen: DG_OnlyPositiveNumber

I hope this helps you!


Kind regards,

Benjith Sam

RWA_Lab_DG_OnlyPositiveNumber.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.