Dynamic + Static columns.

UI Components for JSF
Post Reply
Yellowbike
Posts: 1
Joined: 07 Oct 2010, 19:31

07 Oct 2010, 19:39

Hi all,

I'm trying to create a dataTable that uses dynamic and static columns. I'm using dynamic columns to display the data returned from the database and static columns to provider some action to be performed over a specific row like an "action" column. The problem is, when using p:columns other p:column are simply ignored. Here's my code:

Code: Select all

    <h:form id="dataGrid">
        <p:dataTable value="#{dataLoader.data}" var="d">
            <p:columns value="#{dataLoader.columns}" var="c" columnIndexVar="i">
                <f:facet name="header">#{c}</f:facet>
                <h:outputText value="#{d[i]}" />
            </p:columns>

            <p:column>
                <f:facet name="header">Actions</f:facet>
                <h:commandLink value="Edit" action="#{dataEditor.edit(d)}" />
                <h:commandLink value="Delete" action="#{dataDeleter.delete(d)}" />
            </p:column>
        </p:dataTable>
    </h:form>
At source it seems that DataTableRenderer simple ignores any Column if there is a Columns present. Is there any workaround for this?

svansted
Posts: 1
Joined: 01 Nov 2010, 02:18

01 Nov 2010, 02:25

Exact same issue here. I want a static column or 2 and then dynamic columns after that.

When I have both <p:column> and <p:columns> in the table, the <p:column> is not rendered. When I remove <p:columns>, the <p:column> renders properly.

Are these 2 tags mutually exclusive, or are we missing something?

If they *are* mutually exclusive, is this going to be changed in a future release?


Thanks
Sean

xeo
Posts: 5
Joined: 17 Nov 2010, 22:48

03 Dec 2010, 21:11

I find the way of render colums dynamic, was creating a Dialog to chose the columns to be redered, and use the rendered option.

Code: Select all

<p:ajaxStatus style="text-align: center;width:100%;height:24px;" id="ajaxStatus" >
            <f:facet name="start">
                <p:panel>
                    <img alt="" src="/gem/images/loading.gif"/>
                </p:panel>
            </f:facet>
            <f:facet name="complete">
                <p:panel id="listaEM" header="Resultado de Busqueda"  toggleable="true"  >
                    <h:form>
                        <p:dataTable  value="#{equipoMed.list}" var="selected" id="tableEm"
                                      emptyMessage="No se encontraro Equipos Médicos."  >
                            <p:column rendered="#{equipoMed.filterEm.enabledInst}"  headerText="Institución"    >
                                <h:outputText value="#{selected.institucion}" />
                            </p:column>
                            <p:column  headerText="Servicio Clínico" >
                                <h:outputText value="#{selected.servClin}"  />
                            </p:column>
                        </p:dataTable>
                    </h:form>
                </p:panel>
            </f:facet>
        </p:ajaxStatus>

asermej
Posts: 25
Joined: 30 Jun 2010, 03:24

04 Dec 2010, 22:02

There is an open issue for this:

vote for it here.

See http://code.google.com/p/primefaces/iss ... il?id=1515

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests