[Data Grid Web] [Data Grid Web] - Edit cell after selection from dropdown in popUp
Forge component by OutSystems R&D
Application Type
Traditional Web

Hello, I need help updating a cell with a value from a variable.

What I already did: a user creates a new blank row, selects it and RowEvent triggers a popUp where the user can select a sentence from a dropdown list.



Now, I need to update the column "C", after the presses "OK", with the sentence sellected by the user. 

I already have the sentence in a variable, I really just need to update the cell with the variable value.

Can anyone help me?

Thank you all.

Hello @Pedro ALMEIDA

Thank you for your patience and for your question.

As I said in my previous replies, this is a non-supported feature. Nevertheless, I managed to create a solution that will work in order to answer your needs. Please bear in mind that we didn't make all the necessary tests to ensure that it will work on all cases. 

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

Right now, I would suggest the following workaround (.oml attached to the reply)

1) Add a new JSON Deserialize to the OnNotifyCheckRow screen action to get the property os_RowId from the dataitem that you just got from your first Deserialize.

2) Get your rowIndex via API using the RunJavascript from HTTPRequestHandler.

gObj.grid.rows.find(el => el.dataItem.os_RowId === '" + JSONDeserializeToRowId.Data.os_RowId + "').index;

3) Add a RunJavascript to the SelectOption (screen action from your .oml).

4) Now, you can add your final code in order to set the data that you want on the cell from S column.

gObj.grid.setCellData(rowIndex,'ThingsToDo',""" + selectedOption + """);

.......

Extra step) You can use the Unselect_Row server action to unselect the row after setting its data on the previous step.

......


Hope this answer is useful.

Best regards,

Tiago Pereira

HelpOnDataGrid.oml

It worked like a charm!!!! :D YES!!

Thank you very much Tiago for your support. I wasn't getting the rowID well.

Thank you very much once again.

Best regards.

Pedro

Hi Pedro ALMEIDA,

Please validate 2 points.

1. Selected sentence getting saved and update value is present in the data grid source list

2. ajax refresh the grid once OK" button is clicked

See if above points are taken care.

If you can share oml then it will help to identify the issue.

Thanks,

Vani


Hello @Vani Mankad !

Thank you for your interess in this issue.

I put the .oml attached, because I really can't set the column with the selected value.

I really appreciate your help.

HelpOnDataGrid.oml

Hi,

oml has dependency of "datagridweb" epace. Could you please send that as well?

Thanks,

Vani

Hi.

I got it from Forge and the .oap is attached.

Thx

Data.Grid.Web2.18.2O11.oap

Hello @Pedro ALMEIDA,

Thanks for bringing this subject to the discussion.

I am not sure I understand your use case. The DataGrid component (Trad. Web version) has a column - "GridColumnSelect" that allows selecting the values from options that you provide via the JSONRestURL parameter, which will then populate the dropdown that will appear when you open the edition of a cell from that column.

If that is not a solution for your use case and you need to open that popup (by selecting the checkbox from a row), how would you take care of the multi-selection on the grid? Is it a problem to have the whole logic on the server-side?

Best regards,

Tiago Pereira

Hi @Tiago Miguel Pereira .

I feel that I almost got there, but I'm stuck in the final pace.

The goal is the user be able to write a text in a cell or select a sentence from a group of sentences, when he inserts a new blank row. 

For that I have a column (Text Type). In the example is the 'S' column. When the user wants to select a sentence from the group of sentences he presses a button and a pop-up is raised.

He uses the dropbox from the pop-up to select the sentence he wants. When he presses the "OK" button in the pop-up, THAT sentence must appear in the column  'S'.

The "only" thing I can't do is to populate the cell with the sentence the user chosed.

Thanks for the interess and help.

The goal is to populate a cell without writing directly in it or via JSONRestUrl.

What I think I have to do, somehow is to serialize a JSON and use that as input.

WHat do you think?

Cheers.

Hello @Pedro ALMEIDA,

If I understood correctly, that column will have both an input to write whatever the user needs to but at the same time, if he selects an option from the dropdown, it is supposed to get that value (a mix between a ColumnSelect and a ColumnText).

If so, we are going to try to figure out the best way to handle it. Right now the solution seems to be something like a Javascript running inside a server action (with a RunJavascript from HTTPRequestHandler) placed inside your OnNotifyCheckRow action. That Javascript will have to get the os_rowId in order to find that rowId inside the grid.rows and then you will be able to use the method grid.setCellData (both from wijmo's API) and set the value that you want.

Let me know if this is what you need and we will try to figure out the best solution,

Best regards,

Tiago Pereira

Hi.

Would it be somethig like this? I'm not the best guy with JS.... :(

Thx

Hello @Pedro ALMEIDA,

We are currently analyzing what you asked for by trying to figure out the best solution. We will develop the workaround during the next week. I will get back to you as soon as we have the solution. Is that ok for you?

Thank you,

Tiago Pereira


Hello @Pedro ALMEIDA

Thank you for your patience and for your question.

As I said in my previous replies, this is a non-supported feature. Nevertheless, I managed to create a solution that will work in order to answer your needs. Please bear in mind that we didn't make all the necessary tests to ensure that it will work on all cases. 

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

Right now, I would suggest the following workaround (.oml attached to the reply)

1) Add a new JSON Deserialize to the OnNotifyCheckRow screen action to get the property os_RowId from the dataitem that you just got from your first Deserialize.

2) Get your rowIndex via API using the RunJavascript from HTTPRequestHandler.

gObj.grid.rows.find(el => el.dataItem.os_RowId === '" + JSONDeserializeToRowId.Data.os_RowId + "').index;

3) Add a RunJavascript to the SelectOption (screen action from your .oml).

4) Now, you can add your final code in order to set the data that you want on the cell from S column.

gObj.grid.setCellData(rowIndex,'ThingsToDo',""" + selectedOption + """);

.......

Extra step) You can use the Unselect_Row server action to unselect the row after setting its data on the previous step.

......


Hope this answer is useful.

Best regards,

Tiago Pereira

HelpOnDataGrid.oml

It worked like a charm!!!! :D YES!!

Thank you very much Tiago for your support. I wasn't getting the rowID well.

Thank you very much once again.

Best regards.

Pedro

Hello, taking the example above how do I get Row Id from an existing line?


Hello @Edson Bragança

Can you please check if the following sample helps you achieve what you need?

On the sample, you will find two samples. One of them is just like the one that was marked as the solution of this thread. The other sample, "GridWithData", might be the one that you are looking for.

The logic is the same for both samples, just pay attention to the columnBinding variable which is going to be used to configure the binding of the column where you want the changes to occur after changing the selected option.

Let me know if it helped you,

Best regards,

Tiago Pereira

HelpOnDataGrid.oml

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