Versions :
Aapche MyFaces 2.1.14 RichFaces 4.3.5
Code :
<rich:dataTable var="row" value="#{bean.rowData}"  index="dataIndex">
        <rich:columns value="#{bean.columnData}" var="column" index="ind" sortBy="#{row[column.id].sort}" sortOrder="#{bean.sortOrder[column.id]}">
            <f:facet name="header">
                <h:outputText value="#{column.header}" />
            </f:facet>          
        #{row.value}
        </rich:columns>                 
</rich:dataTable>
Issue :
We are migrating from JSF 1.2 to JSF 2.
As shown in below code snippet , we were using <rich:columns> to dynamically generate columns and to add sort feature for the columns.
Since <rich:columns> is now removed , we need to use <c:forEach> to generate dynamic columns as per
Dynamic columns with richfaces 4
But the issue remains is how to add sort behaviour for the columns.
Is there any alternative available ?
Please help.
EDIT 1 :
I am able to get the desired behaviour by below code , as stated in the comments for the question.
<rich:extendedDataTable id="masterTable" var="row" value="#{bean.rowData}"  index="dataIndex" render="masterTable">       
    <c:forEach items="#{bean.columnData}" var="column">                     
        <rich:column sortBy="#{row[column.id].sort}" sortOrder="#{bean.sortOrder[column.id]}"> 
                    <f:facet name="header">
                        <h:outputText value="#{column.header}" />
                    </f:facet>          
                    #{row.value}
            </rich:column>
    </c:forEach>               
</rich:extendedDataTable>
The reason for using <rich:extendedDataTable> is , it allows built-in sorting with arrows (for sorting order displaying). 
The above set up is working.
The issue is now , after I click on column header for sorting ,ajax reRendering doesn't seem to work. It requires manual page refresh and then sorted data is shown 
on the page.
I have observed same issue earlier at other place with <c:forEach> . When I removed <c:forEach> with <rich:dataGrid> , it worked. But in this case as per post Dynamic columns with richfaces 4,
I have to stick with <c:forEach>
EDI 2 : The ajax rendering issue is observed when sorting is applied to another column than present one . After page is refreshed , sorting for that particular column works fine until another column is applied for sort.