I have a grid with checkboxes for selection. I am adding a 'Select All' function in Javascript by spinning through the checkbox.rows and using the changeElementValue to set the checkboxes to checked. The problem is that rows that are not displayed (below the bottom) do not get changed -when I scroll down they are not checked.
Is this a known issue that I will need to return to the RPG and update the SFL, or is there possibly something that I am missing?
Thanks,
Sean
Select All w/ grid checkboxes
-
- 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:
- matt.denninghoff
- Profound Logic Staff Member
- Posts: 115
- Joined: Wed Feb 10, 2016 3:53 pm
- First Name: Matthew
- Last Name: Denninghoff
- Company Name: Profound Logic Software
- State / Province: Ohio
- Country: United States
- Contact:
Re: Select All w/ grid checkboxes
Right now what you would like to do isn't possible in JavaScript. The grid displays a fixed number of DOM elements, and scrolling causes some to be created and others destroyed. We would need to create an API that would allow you to manipulate what is not visible on the grid.
If you're interested, we can make this a feature request.
If you're interested, we can make this a feature request.
-
- 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: Select All w/ grid checkboxes
Matt,
Thanks for the info. It was what I suspected, so I changed it to return to the RPG where I update the SFL records w/ the checkbox selected.
Sean
Thanks for the info. It was what I suspected, so I changed it to return to the RPG where I update the SFL records w/ the checkbox selected.
Sean
-
- Profound User
- Posts: 24
- Joined: Thu Jan 07, 2016 9:24 am
- First Name: Zoe
- Last Name: W
- Company Name: Previously Anker International
- Country: United Kingdom
- Contact:
Re: Select All w/ grid checkboxes
Hi Sean
I know it's been a while since you posted, but I wondered if you tried iterating through the grid and using setDataValue to check the boxes?
I use something similar to retrieve a value from every row in a grid, even those that are not displayed, so I would assume that setDataValue might work in the same way.
e.g.
I know it's been a while since you posted, but I wondered if you tried iterating through the grid and using setDataValue to check the boxes?
I use something similar to retrieve a value from every row in a grid, even those that are not displayed, so I would assume that setDataValue might work in the same way.
e.g.
Code: Select all
for (i = 1; i < total_rows; i++){
myUnits = parseInt(getObj("sfl1").grid.getDataValue(i, "s1newunits"),10,10);
// do some stuff with myUnits...
}
-
- 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: Select All w/ grid checkboxes
There's a known limitation to setDataValue() at this point -- it can set the value of any row in a grid, but it can't mark an input-capable field as "modified" unless that field has previously been shown on the display. Only values that are marked as "modified" will be sent back to the server.
So it will work fine if all of the rows have previously been on the display. (It will also work fine for output-only fields, since these don't need to be sent back to the server.)
But, for the "checkbox" scenario, it'll really only work for rows that were on the display before setDataValue() was run -- or for rows where the user later goes and makes a change to the checkbox field to mark it modified. So not ideal for that.
A better solution is to just send control back to the RPG program, have the RPG program loop through the subfile and update the checkbox fields, and then re-display the screen. That is easy to code and will work perfectly.
So it will work fine if all of the rows have previously been on the display. (It will also work fine for output-only fields, since these don't need to be sent back to the server.)
But, for the "checkbox" scenario, it'll really only work for rows that were on the display before setDataValue() was run -- or for rows where the user later goes and makes a change to the checkbox field to mark it modified. So not ideal for that.
A better solution is to just send control back to the RPG program, have the RPG program loop through the subfile and update the checkbox fields, and then re-display the screen. That is easy to code and will work perfectly.
-
- 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: Select All w/ grid checkboxes
Scott,A better solution is to just send control back to the RPG program, have the RPG program loop through the subfile and update the checkbox fields, and then re-display the screen. That is easy to code and will work perfectly.
This is the solution that I used.
Thanks,
Sean
Who is online
Users browsing this forum: No registered users and 0 guests