Identifying row in a grid by the way the user sorts in RPG

Use this board to ask questions or have discussions with other Rich Displays users.
DanD
Profound User
Posts: 42
Joined: Wed Jun 14, 2017 12:06 pm
First Name: Dan
Last Name: Devoe
Company Name: Boston Warehouse Trading
State / Province: Massachusetts
Zip / Postal Code: 02062
Country: United States
Contact:

Re: Identifying row in a grid by the way the user sorts in RPG

Post by DanD »

It turns out that the code isn't working in the fashion I'm expecting - the for loop is reading based on the the RRN - not the order in which the grid is sorted by the end-user.

Instead of this:

Code: Select all

var myGrid  = getObj("s1_items");
var gridrec = myGrid.grid.getRecordCount();

for (var i=1;i<=gridrec;i++) {
  myGrid.grid.setDataValue(i, "S1_SORTROW", i);
}
I tried this & it seems to be returning the desired results:

Code: Select all

var myGrid  = getObj("s1_items");
var gridrec = myGrid.grid.getRecordCount();

for (var i=1;i<=gridrec;i++) {
  var rrn = myGrid.grid.getRRN(i);
  myGrid.grid.setDataValue(rrn, "S1_SORTROW", i);
}
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests