[Data Grid] Run Screen Action after Datagrid Action

Forge Component
(41)
Published on 13 Oct (13 days ago) by OutSystems R&D
41 votes
Published on 13 Oct (13 days ago) by OutSystems R&D

Hi,


It's possible to run a screen action after running a datagrid action?


I Notice that when i run the SendRemovedRowsButton action, it's fetching the json from past actions. It would also helped me to clear some variables that i need to be cleared after insert/update/delete actions.

Hello David Rodrigues 


Unfortunately not, today we don't have this functionality.

But, if you want to retrive data from the server again, you can use the ForceRefresh parameter available on insert / update / delete actions, doing so after saving data it will re-call the RestURL to retrieve data.


Hi,


I notice that when we use a Context Menu action with the IsCheck option, even with the ForceRefresh parameter, the rows are unchecked but it's getting the json from past checked rows. I have to manually Refresh Data from the aggregates of the Context Menu to clear the json from past checked rows.


I'm using the Check RowEvent to get the checked rows on a local variable to perform custom update screen actions but i'm unable to clear this local variable when i use the actions from Data Grid.


I think it would be nice to have the possibility to trigger a screen action after the trigger of a Data Grid action.

Hello David,


Sorry, but I didn't understand your last question, you can send me a sample and maybe I can help you solve this problem.


What is this variable for? Is it used to configure the DataGrid?


To clear things out:

  • The Force Refresh will force DataGrid to make a new Get Data after insert/delete/update 
  • The IsCheck parameter from ContextMenuItem will enable/disable menu options considering if there is rows selected the grid
  • The grid is all done in javascript, so everything is running on browser, it is somehow independent from the platform. If you take a look at this post (DataGridCustomColor), notice that to access properties Service Studio object we need do it using Javascript.


What I can do after understanding your issue is open an Improvement task for the team to analyse the possibility of developing events for these actions.

I discovered that i could use the onLoadedRows event to catch when the grid is refreshed.


I'm trying to pass the Id of a button to the function, but on the load of the page the event onLoadedRows is triggered multiple times and i get the error on the browser console when it's triggered for the second time:

 

Uncaught TypeError: o.onLoadedRows is not a function


AdvancedFormat on the Grid:

"onBeginningEdit: customBeginningEdit,
onLoadedRows: testefunc('"+ButtonTest.Id+"')"


Function on Web Screen Javascript:

testefunc = function (Id) {
    console.log(Id);
};



I get a result on the console when the event is triggered for the first time but on the second time i get the error.


Ricardo Valim wrote:

Hello David,


Sorry, but I didn't understand your last question, you can send me a sample and maybe I can help you solve this problem.


What is this variable for? Is it used to configure the DataGrid?


To clear things out:

  • The Force Refresh will force DataGrid to make a new Get Data after insert/delete/update 
  • The IsCheck parameter from ContextMenuItem will enable/disable menu options considering if there is rows selected the grid
  • The grid is all done in javascript, so everything is running on browser, it is somehow independent from the platform. If you take a look at this post (DataGridCustomColor), notice that to access properties Service Studio object we need do it using Javascript.


What I can do after understanding your issue is open an Improvement task for the team to analyse the possibility of developing events for these actions.

 

 

Hello David


Note your function is being executed during the definition of AdvancedFormat, doing this testefunc('"+ButtonTest.Id+"') the onLoadRows receives the result of your function. That's why you got this error.


To pass a method reference, you need to do like is done below:


"onBeginningEdit: customBeginningEdit,
onLoadedRows: testefunc"





David Rodrigues wrote:

I discovered that i could use the onLoadedRows event to catch when the grid is refreshed.


I'm trying to pass the Id of a button to the function, but on the load of the page the event onLoadedRows is triggered multiple times and i get the error on the browser console when it's triggered for the second time:

 

Uncaught TypeError: o.onLoadedRows is not a function


AdvancedFormat on the Grid:

"onBeginningEdit: customBeginningEdit,
onLoadedRows: testefunc('"+ButtonTest.Id+"')"


Function on Web Screen Javascript:

testefunc = function (Id) {
    console.log(Id);
};