0

Why is my listcell label=null?

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

angel7793 gravatar image angel7793
1

I have this zk item

<listitem
                                    id="listitemsolicitudtransporte" 
                                    self="@{each=solicitudtransporte}"
                                    value="@{solicitudtransporte}">
                                    <custom-attributes solicitudtransporte="@{solicitudtransporte}"
                                    xmlns:n="native" />
                                    <listcell id="idsolicitudtransporte">
                                        <label
                                            value="@{solicitudtransporte.idSolicitud}" />
                                    </listcell>
                                    <listcell>
                                        <label
                                            value="@{solicitudtransporte.claveExterna}" />
                                    </listcell>
                                    <listcell>
                                        <label
                                            value="@{solicitudtransporte.fechaSolicitud}" />
                                    </listcell>
                                    <listcell>
                                        <label
                                            value="@{solicitudtransporte.motivoSolicitud}" />
                                    </listcell>
                                    <listcell>
                                        <label
                                            value="@{solicitudtransporte.peticionario}" />
                                    </listcell>
                                    <listcell>
                                    <button id="boton_detalle"
                            sclass="btn-ecg-primary" iconSclass="fa fa-search"
                            style="margin-top:5px;margin-bottom:5px;font-size:15px;"
                            label="Detalle Solicitud" />
                                    </listcell>
                                </listitem>

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
0

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

cor3000 gravatar image cor3000
6280 2 7

the zul code ...

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

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

Follow
2 followers

RSS

Stats

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

Seen: 11 times

Last updated: Sep 26 '18

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