Page 1 of 1
Check boxes / radio buttons in a subfile
Posted: Thu Sep 09, 2010 8:21 am
by nascar88
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 ?
Re: Check boxes / radio buttons in a subfile
Posted: Thu Sep 09, 2010 12:34 pm
by David
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.