Page 1 of 1

rrn from Grid

Posted: Mon Sep 17, 2018 8:57 am
by m400mail
Hello to all

if there a Javascript function to receive the RRN form a Grid .
I read the Grid with following code
RPG CODE
// 
handleRowClick(row);

function handleRowClick(row) {
  var value = getObj("Grid01").grid.getDataValue(row, "EMAILA0001");
  //alert(value);
 pui.set("hd_emailadresse", value); 
 pui.set("HD_Action", '2');
 
 pui.click("HD_BTDisplayData"); 
}
i changed my database wtih hidden button "HD_BTDisplayData" and the hidden key hd_emailadresse
Now i want to refresh the Gridline .

thanks for your help
Michael

Re: rrn from Grid

Posted: Mon Sep 17, 2018 10:12 am
by DanD
Now i want to refresh the Gridline .
At the end of the function, did you try
"Grid01".grid.render(); ?

Also at the beginning of the function you may want to add the line
var myGrid = getObj("Grid01");

and then use
myGrid.grid.render();

So your new function would look like (untested)

Code: Select all

// 
handleRowClick(row);

function handleRowClick(row) {
  var myGrid = getObj("Grid01");
  var value = myGrid.grid.getDataValue(row, "EMAILA0001");
  //alert(value);
 pui.set("hd_emailadresse", value); 
 pui.set("HD_Action", '2');
 myGrid.grid.render();

Hope this helps

Re: rrn from Grid

Posted: Mon Sep 17, 2018 10:22 am
by m400mail
Hi ,

thanks,

but with pui.click("HD_BTDisplayData") starts my RPG program and updates the database record.

now i want to refresh only this one record on the Grid .

Re: rrn from Grid

Posted: Mon Sep 17, 2018 11:20 am
by DanD
Are the fields defined as Output fields, or text box, text area, hyperlink, etc?

If output, when control gets passed back to the RPG program, the values set that are changed within the grid will revert back, as they are not passed back to the program. Try changing the field to a text box (or other input-capable field) with an attribute of read-only.

Re: rrn from Grid

Posted: Mon Sep 17, 2018 11:26 am
by Scott Klement
Michael,

You have the 'row' variable in the JavaScript code that you posted. You should be able to put this into a hidden textbox the same way you're doing the email address and action values. Then, the RPG program can read that row number, and can do a CHAIN to that subfile row, change the fields, and UPDATE to update the row.

Is that what you are asking?

Re: rrn from Grid

Posted: Tue Sep 18, 2018 4:16 am
by m400mail
Hello to all
and thank you for your input.

I did not know how to determine the row number
RPG CODE
pui.set("HD_SelectedRow", row);
This works fine.

thanks for your help