Why is my listcell label=null?

asked 2018-09-24 16:59:01 +0800

angel7793 gravatar image angel7793

I have this zk item

                                    <custom-attributes solicitudtransporte="@{solicitudtransporte}"
                                    xmlns:n="native" />
                                    <listcell id="idsolicitudtransporte">
                                            value="@{solicitudtransporte.idSolicitud}" />
                                            value="@{solicitudtransporte.claveExterna}" />
                                            value="@{solicitudtransporte.fechaSolicitud}" />
                                            value="@{solicitudtransporte.motivoSolicitud}" />
                                            value="@{solicitudtransporte.peticionario}" />
                                    <button id="boton_detalle"
                            sclass="btn-ecg-primary" iconSclass="fa fa-search"
                            label="Detalle Solicitud" />

When i execute the application, the table has values in every row, but when i try to access to the content of the first cell, the listcell with id="idsolicitudtransporte" has label=null, but in my screen there is a number. I need to manipulate that number and i don't find how to obtain it.

In my controller the listcell has the @Wire anotation.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-09-26 10:52:33 +0800

cor3000 gravatar image cor3000
5099 2 7
ZK Team

the zul code ...

<listcell id="idsolicitudtransporte">
    <label value="@{solicitudtransporte.idSolicitud}" />

will create a listcell with a <label/> child component

In this case listcell.getLabel() is still null. If you don't want to change your zul code you can access the label value via ((Label)listcell.getFirstChild()).getValue();

Or if you can change the zul code use the label property on listcell directly:

<listcell id="idsolicitudtransporte" label="@{solicitudtransporte.idSolicitud}" />

Then listcell.getLabel() has a value to return.

Closing recommendation: since you are using data-binding I'd suggest to just access the value at your original java object by calling solicitudtransporte.getIdSolicitud() ... there's no need to access the zk components directly if you can get the data directly of your original object. Doing so the UI can change but your code accessing your data will still work -> decoupling model from presentation which is the goal of data binding.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2018-09-24 16:59:01 +0800

Seen: 8 times

Last updated: Sep 26 '18

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More