Page 1 of 1

subfile sorting & data driven subfile

Posted: Thu Apr 30, 2015 3:04 pm
by karlabbott
I want to have a subfile with column sorting capability.
Subfile sorting only sorts the records loaded into the subfile at the time you click the sort. That makes sense. so I need to load the entire subfile in order for sorting to work effectively. Or pass the column sort response fields back to the server... which I'd rather not do because it's a lot more work.
If I load the whole subfile it will be more than 9999 rows, so I need to use a database driven subfile grid.
However, I can't tell how to return to the RPG program the record or records that the user selects. Since the subfile is built on the client side, the server isn't aware of record numbers or what's loaded into them. so I will need to return all of the fields of the selected record(s).
Is this possible? And does someone have an example of how to do this?

Re: subfile sorting & data driven subfile

Posted: Thu Apr 30, 2015 3:55 pm
by Scott Klement
You can't return data from the database-driven subfile to an RPG program. It can't work because the RPG program doesn't have the fields, etc, in the record format and the data isn't in the OA handler, it's just loaded onto the screen directly from the database. (and, even if you did make this readable from RPG, that would re-impose the 9999 limit.)

I would suggest using the column sort response.

Re: subfile sorting & data driven subfile

Posted: Mon May 04, 2015 10:13 pm
by Brian
It could be done by having hidden fields in the control record format for the key fields needed from the grid. You would need to use some custom javascript on the onrowclick or onrowdblclick event of the grid to retrieve the data from the row and populate the hidden fields. This of course would only work for selecting a single row. If this sounds like a viable solution for you, I can look around for an example.

Re: subfile sorting & data driven subfile

Posted: Thu Dec 22, 2016 11:41 am
by pkenosky
Brian wrote:It could be done by having hidden fields in the control record format for the key fields needed from the grid. You would need to use some custom javascript on the onrowclick or onrowdblclick event of the grid to retrieve the data from the row and populate the hidden fields. This of course would only work for selecting a single row. If this sounds like a viable solution for you, I can look around for an example.
This is something I am currently trying to do... Is this possible?
Do you have an example of the javascript code that would need to go in onrowclick?

Re: subfile sorting & data driven subfile

Posted: Thu Dec 22, 2016 4:01 pm
by pkenosky
Believe I found what I was looking for on another post "Database-Driven Subfile Cell Access"

changeElementValue("TextBox1", getObj("Grid1").grid.getCellValue(row,0));
pressKey("enter");