0
votes

My dataTable is populated by an ajax call, my commandLink (in the datataable) is not pointing to the correct location and always render the same page.and show me in the console : HtmlLabelRend W Attribute 'for' of label component with id j_id1471051656_3ffdbef6:j_id1471051656_3ffdbfc6 is not defined

But when I put the commandlink outside the datatable the action method works fine.

This problem is rare!, How Can I solve it?

Thanks in advance.

My Jsf Page:

<h:form>
        <p:panel header="Busqueda">
            <p:panelGrid style="width:100%;">
                <p:row>
-----------------------------------(inputs)---------------------------------------
                    <p:column>
                        <p:commandButton value="Buscar" update="grilla"
                            action="#{devolucionAdminController.buscarSD()}">´
                            </p:commandButton>
                    </p:column>
                </p:row>
            </p:panelGrid>
            <p:messages closable="true" redisplay="true" id="msj"></p:messages>
        </p:panel>
        <p:dataTable id="grilla" var="r"
            value="#{devolucionAdminController.listado}"
            emptyMessage="No se han encontrado solicitudes de devolución">
            <p:column headerText="Sec">
                <h:outputText value="#{r.idSoliDevo}" />
            </p:column>
            <p:column headerText="Cuenta">
                <h:outputText value="#{r.cuentaId}" />
            </p:column>
            <p:column headerText="Ver Detalle Sol. Dev ">
                <p:commandLink 
                    action="#{bajaController.mostrarSolicitudBaja(r.cuentaId,r.idSoliDevo)}" ajax="false">
                    <p:commandButton icon="ui-icon-search" title="Ver Detalle" />
                </p:commandLink>
                </p:column>
        </p:dataTable>

<!--works fine  -->
    <p:commandLink action="#{bajaController.mostrarSolicitudBaja(80003,340)}"
            ajax="false">
            <p:commandButton icon="ui-icon-search" title="Ver Detalle" />
        </p:commandLink>
        </h:form>

My first Managed Bean:

@ManagedBean
@RequestScoped
public class DevolucionAdminController {
 List<TaSoliDevo> listado;
//getters and setters
........................
public void buscarSD() {

   .............................
}

My second Managed Bean:

@ManagedBean
@RequestScoped
public class BajaController {

    public String mostrarSolicitudBaja(long cuentaId, long solicDevId) {
    .........................
    return "goResult";

}}
4
why you are putting a p:commandButton inside a p:commandLink , it ha sno sense ! - ktaria
try this code inside the datatable: <h:commandLink action="#{bajaController.mostrarSolicitudBaja(80003,340)}" ajax="false" value="theNameOfLink"> </h:commandLink> - ktaria
Hi, I putted the code inside the datatable but I return a different page(the home page). - user2683519
and this code <h:commandLink action="#{bajaController.mostrarSolicitudBaja(80003,340)}" value="theNameOfLink"/> - ktaria
Nothing,I achieved the same result..... - user2683519

4 Answers

0
votes

replace your commandLink with

<p:commandButton  icon="ui-icon-search" title="Ver Detalle"
action="#{bajaController.mostrarSolicitudBaja(r.cuentaId,r.idSoliDevo)}" ajax="false"/>

Really no need to put a command button inside a command Link, just to put an icon

2
votes

Use process="@this" and use actionListener instead of action

<p:commandLink process="@this" actionListener="#{bajaController.mostrarSolicitudBaja(80003,340)}"></p:commandLink>
1
votes

remove the ajax="false" tag, its work for me

1
votes

I had the same problem and I was struggling to find a solution but nothing worked for me. Here is how I finally solved the problem :

  • I removed the ajax attribute
  • I added process="@this"

Here is what my commandLink looks like after the changes :

<p:commandLink process="@this" action="#{projsSummaryBacking.redirectProjTasks(proj)}" >
   <h:outputText value="#{proj.title}" />
</p:commandLink>

I hope that this can help someone. /m\