Row selection in database driven grid
-
- Profound User
- Posts: 20
- Joined: Wed Aug 22, 2012 11:30 am
- First Name: Jeff
- Last Name: Wurst
- Company Name: BBCS
- State / Province: Washington
- Country: United States
- Contact:
Row selection in database driven grid
I've got a grid control that's loaded using the "custom sql" property. Now I need to do row selection. I tried turning it on by setting "row selection" to single. This doesn't work. Clicking on the rows doesn't result in selection. I can get the row# from javascript on click or double click, but I can't find a way to get anything from that row when I'm operating the grid/subfile in this way. Does anyone have any idea how to make row selection work? I need to find some way to tell the program which row was selected.
- Kaylee Law
- Profound Logic Staff Member
- Posts: 13
- Joined: Mon Sep 18, 2017 11:36 am
- First Name: Kaylee
- Last Name: Law
- Company Name: Profound Logic
- Contact:
Re: Row selection in database driven grid
Hello jwurst,
If you create a hidden text box on the screen and bind it to a RPG field, you can then use the onrowclick event to set the value of the hidden text box to the row number that you want to return to the RPG program.
This method of course will not show the row as selected in the subfile, but if you submitting the screen with something like a pui.click() also in the same onrowclick event, the end user may not need to see which row was selected.
Would this method work for you?
If you create a hidden text box on the screen and bind it to a RPG field, you can then use the onrowclick event to set the value of the hidden text box to the row number that you want to return to the RPG program.
This method of course will not show the row as selected in the subfile, but if you submitting the screen with something like a pui.click() also in the same onrowclick event, the end user may not need to see which row was selected.
Would this method work for you?
Kaylee Law
Technical Support Specialist
Profound Logic Software
Technical Support Specialist
Profound Logic Software
-
- Profound User
- Posts: 20
- Joined: Wed Aug 22, 2012 11:30 am
- First Name: Jeff
- Last Name: Wurst
- Company Name: BBCS
- State / Province: Washington
- Country: United States
- Contact:
Re: Row selection in database driven grid
I can use this, but not very well. The problem is the row number is only marginally useful in the RPG program behind. The program has to re-run the query with a wrapper around it to select by row number. That's the only way I've found to get back to the correct record.
Besides the inelegance of having to run a fairly heavy weight query to get figure out what data is in the row, Doing this also results in me having to turn off the ability to sort the grid by clicking on the headings. Otherwise the row number becomes meaningless. I would really like to have the sorting feature turned on.
Oh well. In this particular case this is still better than having to load the grid row by row from the RPG.
Besides the inelegance of having to run a fairly heavy weight query to get figure out what data is in the row, Doing this also results in me having to turn off the ability to sort the grid by clicking on the headings. Otherwise the row number becomes meaningless. I would really like to have the sorting feature turned on.
Oh well. In this particular case this is still better than having to load the grid row by row from the RPG.
-
- Profound User
- Posts: 76
- Joined: Fri Jan 11, 2013 6:11 pm
- First Name: Sean
- Last Name: Tyree
- Company Name: US HealthWorks
- State / Province: California
- Zip / Postal Code: 91355
- Country: United States
- Contact:
Re: Row selection in database driven grid
Hello,
Instead of populating the hidden field with the row number and regenerating the data in the query, your onclick could pull the key information (or whatever is needed to continue with the selected row) and populate that in the hidden field. The a pui.click could react to the data populated in the hidden field.
Sean
Instead of populating the hidden field with the row number and regenerating the data in the query, your onclick could pull the key information (or whatever is needed to continue with the selected row) and populate that in the hidden field. The a pui.click could react to the data populated in the hidden field.
Sean
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Row selection in database driven grid
It's not clear why you're using a database driven grid for this program? Generally, when people want data that's returned back to their program, they don't use a DB-driven grid, because it has no way of returning data back.... since no variables are configured for a DB-driven grid, there's nothing in the record format to communicate data to your program.
DB-driven grids are typically only used for read-only grids. when you need more features, people typically switch to a normal grid, loaded from the program. Then you can use row selection if you like, or whatever else.
If it's really important to use a DB-driven grid for some reason (for example, because it can bypass RPG's 9999 row limit) then you could certainly return the actual contents of the row rather than just the RRN, as Sean suggests. The contents would be retrieved using the getCellValue() API documented here: http://www.profoundlogic.com/docs/pages ... Id=4849913
DB-driven grids are typically only used for read-only grids. when you need more features, people typically switch to a normal grid, loaded from the program. Then you can use row selection if you like, or whatever else.
If it's really important to use a DB-driven grid for some reason (for example, because it can bypass RPG's 9999 row limit) then you could certainly return the actual contents of the row rather than just the RRN, as Sean suggests. The contents would be retrieved using the getCellValue() API documented here: http://www.profoundlogic.com/docs/pages ... Id=4849913
Who is online
Users browsing this forum: No registered users and 6 guests