Liferay SearchContainer with multiple classes

298 views Asked by At

I want to make a date list with patients and doctors, in database have 1: N, and the patients is reference by the id, when i do a simple serach-container the column doctorName is null because the patient class has not a name namedDoctor , Only have idDoctor and the doctorName it owns a doctor class, so i have two classes and 1 search-container and i do not know how to put the names of doctors :/

Search-container

' emptyResultsMessage="empty-cita-menssage-result"> " total="<%= CitaLocalServiceUtil.getCitasCount() %>" /> <

<liferay-ui:search-container-row className="com.everis.formacion.model.Cita"
    keyProperty="idCita"
    modelVar="cita"
    escapedModel="<%= true %>">

    <liferay-ui:search-container-column-text
        name="fechaCita"
        property="<%= CitaPortlet.REQUEST_FECHA_PACIENTE_PARAM %>"
    />

    <liferay-ui:search-container-column-text
        name="nombrePaciente"
        property="<%= CitaPortlet.REQUEST_NOMBRE_PACIENTE_PARAM %>"
    />

    <liferay-ui:search-container-column-text 
        name="nombreDoctor"
        property="<%= DoctorPortlet.REQUEST_NOMBRE_PARAM %>"
    />

    <liferay-ui:search-container-column-text 
        name="comentarios"
        property="<%= CitaPortlet.REQUEST_COMENTARIO_PARAM %>"
    />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />

1

There are 1 answers

0
AudioBubble On BEST ANSWER
    <liferay-ui:search-container-column-text
        value="<%= DoctorLocalServiceUtil.getDoctor(cita.getIdDoctor()).getNombreDoctor() %>"
        name="Nombre Doctor"
    />

with this return the name of the doctor :)