Question

I basically have a datatable in which one of the columns is clickable. I have done this by using the commandlink from primefaces.

Everywhere people have used this only to navigate, but I want the click to result in opening a sub datatable. Depending on which row I click on in that column the corresponding datatable must appear.

Can this be done using in primefaces, if so how do I proceed? Thanks

Was it helpful?

Solution

I finally resolved this problem. I basically created one datatable and hid it, depending on the column clicked I used the backing bean to populate the datatable accordingly. I made the onclick event call a function in the backing bean using the following code:

<p:column headerText="Train" style="font-size:90%;font-family:Times New Roman, Times, serif;">
    <p:commandLink onclick="javascript:ShowHide('HiddenDiv');"
        id="tableUpdater" update=":closeButton,:subForm:trainTable" value="#{rail.trainNo}"
        action="#{yardMaster.populateTrainDetails(rail.trainNo)}"
        style="font-family:Times New Roman, Times, serif;">
    </p:commandLink>
</p:column>

So basically something like a dynamic datatable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top