You need to sign in to do that
Don't have an account?
JeriMorris
Putting selectCheckBoxes in columns
My VisualForce page includes the following checkboxes:
They all display in a single column. If I remove the layout attribute, they all display on a single line (wrapped to new lines if necessary). I'd rather they displayed in rows and columns, so that if there were 12 checkboxes, they'd display in 3 rows with 4 columns of checkboxes. Is there any way to do that?
Thanks,
Jeri
<apex:pageBlockSection columns="4"> <apex:selectCheckBoxes value="{!SelectedThings}" layout="pageDirection"> <apex:selectOptions value="{!AllThings}" /> </apex:selectCheckBoxes> </apex:pageBlockSection>
They all display in a single column. If I remove the layout attribute, they all display on a single line (wrapped to new lines if necessary). I'd rather they displayed in rows and columns, so that if there were 12 checkboxes, they'd display in 3 rows with 4 columns of checkboxes. Is there any way to do that?
Thanks,
Jeri
Renders an HTML table element in which each component found in the body of the panelGrid is placed into a corresponding cell in the first row until the number of columns is reached. At that point, the next component wraps to the next row and is placed in the first cell. Note that if a repeat component is used within a panelGrid component, all content generated by the repeat component is placed in a single panelGrid cell. The panelGrid component differs from dataTable because it does not process a set of data with an iteration variable. See also panelGroup.
I get exactly the same results as before -- all the checkboxes display vertically, one per row. If I change "pageDirection" to "lineDirection," it puts them all in a single row.
As Ron pointed out, the description of panelGrid says, "Renders an HTML table element in which each component found in the body of the panelGrid is placed into a corresponding cell..." It's as if VF considers all the checkboxes to be a single component, so it puts them all into a single cell.
Any ideas?
Jeri
Hi JeriMorris,
Did you find the solution for this..?
please post the solution if you found a way to achive this, any help is much appreciated.
Thanks in advance.
Perhaps there's something in Winter 09 to improve layout of select checkboxes.... I haven't had a chance to look yet.
If you find a solution, please post it here! I'll do the same.
Thank you,
Jeri.
I was also frustrated that the selectCheckboxes tag does not support a columns attribute.
To solve the problem I am using javascript to rewrite the DOM after Salesforce has created it.
In my selectCheckboxes tag I ensure that resulting table can be identified using
I then add the following javascript
This rewrites the single row into a set of rows.
Thank you, charris! That helped me very much!