[Data Grid Reactive] Option MandatoryOnGrid
Question
Forge component by Bruno Martinho

Hi,


Can you add an extra option "MandatoryOnGrid" on the Columns blocks?


The goal is to ensure that the user cannot remove the column from the grid:



Thanks,

Bruno F. Cantante

Hello @bfcantante ,

We believe we understand your use case but including that parameter for now is not on our roadmap.

I'm not able to propose a workaround because that needs some (not a lot) of change in the component's core.

That said, I would welcome you take a look at the Reactive Data Grid code repository in Github, that is the source code for the Data Grid's JS code.

Please a take a look at the file in code\src\WijmoProvider\Features\ColumnPicker.ts, where the column picker is being built:

If you create an attribute in the structure ColumnOptionalConfigs like ShowInColumnPicker, then you could use the value of that variable to define if that column appears in the picker.

If you are able to implement this, and submit a Pull Request, although it is not on our roadmap, we will be more than available to review it, test it and if everything is ok, to include in the next Data Grid component Release.

Please let me know your thoughts.

Bruno Martinho

Hi,

Thanks Bruno. I did a workaround, but it is not elegant, I will not share :)

I will try to get some time to look at the github project.


Best Regards,

Bruno F. Cantante

Hi Bruno Martinho,

Already created a pull request in the repository:

https://github.com/OutSystems/outsystems-datagrid-reactive/pull/90

About the outsystems oml, let me know if you need me to do it and send it, but it's pretty simple and fast.

Best regards,
Ricardo Madeira

mvp_badge
MVP

Hi @Ricardo Neto,

Thank you for your PR.

Allow us some time to review it and understand potential side effects, and finally create tests to ensure future stability of it. We'll keep you updated! :)

Some questions:
1. Is the parameter "Mandatory", mandatory?
2. Where did you add the parameter in your sample?
2.a. in the root?
2.b. in the structure ColumnOptionsConfig?
3. Do you have a working sample*? or a url* you can provide?


Hope to hear from you, Thank you.

Cheers,
RG


* You may provide them through PM

Hi Ruben,

So this is a screenshot of your JS compontent's options:

You are passing, through a private intermediary block (GenericColumn), this inputs:


The idea is to use the isRequired option in order to have this new feature, because the property is not beign used right now (let's not mix up 'isRequire' with 'Mandatory', cause they have different purposes).
So at first sight I would say changing the 'ColumnOptionalConfig' would be the best solution, and add, at least, the isRequired attribute, so we can add the logic to disable the toggle visibility feature of the columns marked as required (in the Column Picker class), and make use of the attribute.

But your ActionColumn block has a different structure to pass as options, and that takes me to a question I wanted to ask, why don't you let your ActionColumns to be sortable, or even add a click event on all types of columns? Is there any issue with allowing sort and binding click events simultaneously? Because I edited the component to allow sort on Action Column by default and it gaves me no errors or missbehaviors.

Basically, I would extend the ColumnOptionalConfigs structure with all the options that are being used in the component's script, plus isRequired so we can use it in that script that I edited in the pull request, and I'd use that structure also in Action Column block's input, instead of the reduced structure that you're using right now. 

I'd also add a click event like Action Column has, to all other column blocks.

p.s.: I just realize that you assign isRequired to this.required, beign 'this' the configuration object, so you got to name the attribute 'required' instead.

I send my proposal (oml) for the feature attached. I didn't anything about the click event in that version.

Best regards,
Ricardo Madeira

DataGridReactive.oml

Hello @Ricardo Neto,

I really have to say that I'm thrilled with your analysis and commitment also. We will do our best for you to really fell that you have the power to influence and to help improve this product!

We'll analyze the proposed approach (I really like that you consider this a parameter that should be Optional) and get back to you with our analysis.

I believe I understand the OnClick in every column, but our concern is that, for columns in edit mode, the behavior of the OnClick wouldn't be clear, are you clicking on the cell to handle the click or are you clicking to edit the cell value? 

Regarding the Action Column, we have on our backlog a task to analyze it and improve it, because the column can have a fixed text or bind to the data source, and we detect some issues depending on this selection in our technical discovery task.

We are actively working on this, so we'll keep you posted.

Thanks,

Bruno Martinho



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