0
votes

I have an HTML table setup in a visualforce page with some functionality that appears to be outside of the grasp of a standard apex:datatable. When a user updates the information for one of the rows, I'm attempting to rerender the table so the updated values are reflected. If I use an apex:datatable this works fine, BUT then i lose a lot of the functionality I had to add in my table.

The structure is fairly simple, but this is how it goes:

    <table>
        <thead>
            <tr>
                <th>Col 1</th>
            </tr>
        </thead>

        <tbody>
        <apex:outputPanel id="table-panel">

            <apex:repeat value="{!Parent}" var="row">
                <tr name="{!row.Id}">
                    <td>Cell 1</td>
                </tr>
                <apex:repeat value="Child__r" var="child">
                    <tr name="child-{!row.Id}">
                        <td>Child Cell 1</td>
                    </tr>
                </apex:repeat>      
            </apex:repeat>
        </apex:outputPanel>
        </tbody>

    </table>

This is in essence the functionality I'm trying to accomplish, with a parent object's children listed below it. As of right now, the rerender converts all my table elements into spans and completely garbles everything. Is it possible to rerender a non-visualforce component, or, alternatively, is there a way I could reproduce this functionality in an apex:datatable?

Thanks!

2
I do not see any problem here, just reRender your "table-panel"?mast0r

2 Answers

0
votes

Its easy. Try this, works fine for me even after rerender:

<apex:panelGrid columns="1" width="400" id="myTable">

    <apex:facet name="header">
        <apex:outputText value="My table header"/>
    </apex:facet>

    <apex:repeat value="{!Object}" var="row">

        <apex:outputText value="{!row.name}" style="display:block;font-weight:bold;"/>

        <apex:repeat value="{!row.ObjectChild__r}" var="child">

            <apex:outputText value="{!child.name}"/> <br/>

        </apex:repeat> 

    </apex:repeat>         

</apex:panelGrid>

Noe you can reRender your "myTable".

0
votes

I actually ended up discovering the nifty little "layout" attribute of the apex:outputPanel element. Setting this to "block" completely solved all the problems associated with this.