21
Views
5
Comments
[Data Grid Web] DataGrid cannot pick up prepareCellForEdit events
Forge component by OutSystems R&D
41
Published on 14 Dec 2020
Application Type
Traditional Web

Hi,

In the DataGrid (wijmo) event, there is prepareCellForEdit,

This event does not occur when using the DataGrid.


Is it possible to catch the prepareCellForEdit event in OutSystems' DataGrid?


please teach me.

Staff
Rank: #566

Hello Yuichiro,

I prepared a sample for showing how you can do it.

Hope I could help!

Ricardo Valim

DataGridPrepareCellForEdit.oml

Rank: #12496

Thank you for providing the sample.

Looking at the sample I received, I confirmed that the logic of prepareCellForEdit is as follows.


GridOS.ExternalAPI.afterGridInit = () => {

     var gridId = GridOS.GridObject [0] .gridId;

     GridOS.ComponentUtils.getGridObjectById (gridId)

         .grid

         .prepareCellForEdit

         .addHandler ((grid, e) => console.log ('your event goes here!'))

};


When I check the Console log, I don't see "'your event goes here!'".

The Grid version is 2.13.3, but this doesn't matter, right?


What's wrong?

Staff
Rank: #566

Hello Yuichiro,


The prepareCellForEdit is triggered only when you start editing a Cell.

Could you please explain to me what are you trying to achieve? This way I can try to help you in the best way.


Kind regards

Ricardo Valim

Rank: #12496

I am grateful for your help.


I can't seem to catch the prepareCellForEdit event and this Javascript doesn't work.

I've set this Script to Javascript on WebScreen, do I need any other support related to this Script?


What I want to do with this Script is that when a date type item is hovered over, I want to leave it unset instead of setting the system date by default.

Staff
Rank: #483

Hello @Yuichiro Tada,

It seems that the code presented in the sample that Ricardo provided can only be used in version 2.18.0 or later.

As a workaround for this, I would suggest the following code:


setTimeout(function(){

   GridOS.GridObject[0].grid

       .prepareCellForEdit

       .addHandler((grid, e) => console.log('your event goes here!'));

},1000);


Hope this helps,

Best Regards,

Tiago Pereira