288
Views
5
Comments
Solved
[OutSystems Data Grid] Delete cell content with delete key
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

Hello,

Is there any way of deleting the content of a cell using the delete key ?

I've tried in text column and it works but it doesn't work in the other column types.

I would like to have it working for the number columns at least.

Thank you!


2020-08-31 15-57-57
Tiago Miguel Pereira
Staff
Solution

Hello @Daniel Figueira,

At the moment, that configuration is not available on the DataGrid component and you will only be able to activate it with a workaround. 

In order to be able to clear a cell from the grid with the delete key, the column must have the property isRequired set to False (set by default by Wijmo to "Text" columns but not the remaining ones), right now that configuration is not available on the DataGrid component. Nevertheless, you will be able to set it with JS. 

For further information about that property, you can have a look at the property isRequired on Wijmo's documentation.

---------------

Right now, I would suggest the following workaround:

Add an onReady client action to the Screen. Inside, you might want to add JavaScript just like in the image below.

Code-------------------------------------------------------------

GridAPI.GridManager.Events.Subscribe(

     $parameters.GridId,

     ExternalEvents.GridEventType.Initialized,

     function (gridId, gridObj) {

    gridObj.getColumn('Sample_Product.Price').provider.isRequired = false;

    }

);

---------------------------------------------------------------------



Hope this answer is useful.

Best regards,

Tiago Pereira

2019-06-24 10-44-54
Daniel Figueira

Hi,

Thank you, it works.

2020-08-31 15-57-57
Tiago Miguel Pereira
Staff

Hello @Daniel Figueira,

I'm glad it worked for you.

Please bear in mind that we didn't make all the necessary tests to ensure that it will work on all cases. We are continuously working to provide more API methods, so I suggest you keep tuned, as we intend to launch new events that might replace the code that I provided in my previous answer in order to make it easier to custom such behaviors.

Best regards,

Tiago Pereira

2022-11-02 07-18-33
Nicholas Campbell

I am getting the following error when I attempt this. Can you tell me what I am doing wrong/what dependencies I am missing?

Screenshot_6.png
2022-11-02 07-18-33
Nicholas Campbell

I followed the instructions here and it worked.

https://www.outsystems.com/forums/discussion/70807/outsystems-data-grid-externalevents-is-not-defined/

New code I used:

GridAPI.GridManager.GetGridById($parameters.GridWidgetId).getColumn...

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