Check boxes / radio buttons in a subfile
-
- Profound User
- Posts: 42
- Joined: Wed Aug 04, 2010 5:12 pm
- First Name: Bob
- Last Name: Steach
- Company Name: APHA
- Contact:
Check boxes / radio buttons in a subfile
Thanks for the javascript that sets the check box to checked. That is working. Is there anyway to do the same with check boxes and/or radio buttons in a subfile since each column has the same element id ?
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: Check boxes / radio buttons in a subfile
You can only do this in a subfile if all records in the subfile are displayed at the same time with no scrollbar -- i.e. a single page-at-a-time subfile.
This is because the subfile grid widget uses "virtual" rendering where the records not currently scrolled into view do not exist as elements in the browser. It actually renders what it needs to display as you are scrolling.
If you have a "load all" type subfile, the only way you can check all the boxes is to submit the screen to the server and update the subfile with RPG.
If all your subfile records are displayed at one time, though, you can use JavaScript in a similar way to check them.
Profound UI simply appends a suffix to the id of an element in a subfile record. So, an element you've given the id "yourId" will become "yourId.1", "yourId.2", etc.
You could have a loop in the JavaScript test for the existence of "yourId." + n, where n is an incrementing record number. If found, it could check the boxes, if not (no more subfile records), it would quit.
This is because the subfile grid widget uses "virtual" rendering where the records not currently scrolled into view do not exist as elements in the browser. It actually renders what it needs to display as you are scrolling.
If you have a "load all" type subfile, the only way you can check all the boxes is to submit the screen to the server and update the subfile with RPG.
If all your subfile records are displayed at one time, though, you can use JavaScript in a similar way to check them.
Profound UI simply appends a suffix to the id of an element in a subfile record. So, an element you've given the id "yourId" will become "yourId.1", "yourId.2", etc.
You could have a loop in the JavaScript test for the existence of "yourId." + n, where n is an incrementing record number. If found, it could check the boxes, if not (no more subfile records), it would quit.
Who is online
Users browsing this forum: No registered users and 0 guests