Revision history [back]

click to hide/show revision 1
initial version

asked 2019-02-22 07:24:23 +0800

bztom35 gravatar image bztom35

select first item in bandbox using MVC not working.

--This is how I populate my data: private ListModelList<statelist> rsStateAbbrList; ... public void doBeforeComposeChildren public void doBeforeComposeChildren(Component comp) throws Exception { super.doBeforeComposeChildren(comp); /** State ********/ StateData getStateTypeData = new StateData(); rsStateAbbrList = getStateTypeData.getStateDataList(); comp.setAttribute("rsStateTypeList", rsStateAbbrList);

}


@Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp);

  /* select first item **/

 rsStateAbbrList.addToSelection(rsStateAbbrList.get(0));

}

select first item in bandbox using MVC not working.

  • --This is how I populate my data: data:

    private ListModelList<statelist> rsStateAbbrList; ... rsStateAbbrList;

    public void doBeforeComposeChildren public void doBeforeComposeChildren(Component comp) throws Exception { super.doBeforeComposeChildren(comp); super.doBeforeComposeChildren(comp); /** State ********/
    StateData getStateTypeData = new StateData(); StateData();
    rsStateAbbrList = getStateTypeData.getStateDataList(); getStateTypeData.getStateDataList();
    comp.setAttribute("rsStateTypeList", rsStateAbbrList);rsStateAbbrList);

}


@Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp);

  /* select first item **/

 rsStateAbbrList.addToSelection(rsStateAbbrList.get(0));

}

select first item in bandbox using MVC not working.

  • --This is how I populate my data:

    private ListModelList<statelist> rsStateAbbrList;

    public void doBeforeComposeChildren public void doBeforeComposeChildren(Component comp) throws Exception { super.doBeforeComposeChildren(comp);
    StateData getStateTypeData = new StateData();
    rsStateAbbrList = getStateTypeData.getStateDataList();
    comp.setAttribute("rsStateTypeList", rsStateAbbrList);

}


@Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp);

  /* select first item **/

 rsStateAbbrList.addToSelection(rsStateAbbrList.get(0));

}

--2.22.2019 update:

It did select the first item; however, it did not display the text instead it displays the object list ex."lmarsFormsDAO.StateList@13accb6".

Here is zul file.

bandbox id="statebandbox"
listbox id="rsStateListBox" onSelect="rsStateTypeID.value = self.selectedItem.label;rsStateTypeID.close();" checkmark="true" selectedItem="@{RS.getStatename}"

listitem self="@{each='RS}" value="@{RS.getStateAbbr}"
listcell label="@{RS.getStatename}"


..doAfterCompose(Component comp) throws Exceptions{
super.doAFtercompose(comp)
StateData getStateTypeData = new StateData();
ListModelList<statelist> rsStateAbbrList = new ListModelList(getStateTypeData.getStateDataList());

rsStateAbbrList.addToSelection(rsStateAbbrList.get(0));
this.rsStateListBox.setModel(rsStateAbbrList);

click to hide/show revision 4
Updated correct syntax.

select first item in bandbox listbox using MVC not working.

  • <bandbox id="rsStateTypeID" autodrop="true" sclass="labelstyleDetail" style="font-weight:plain; font-size:11pt; color: #00008B; " hflex="1" mold="rounded"> <bandpopup height="100%" sclass="labelstyle" width="280px"> <listbox id="rsStateListBox" width="250px" hflex="true" mold="paging" pagesize="5" model="@{rsStateModel}" selecteditem="@{RS.getStatename}" onselect="rsStateTypeID.value = self.selectedItem.label;rsStateTypeID.close();" checkmark="true"> <listhead> <listheader label="State Selection"/> </listhead> <listitem self="@{each='RS'}" value="@{RS.getFcst_sensor_id} "> <listcell label="@{RS.getStatename}" style="font-weight:plain; font-size:9pt; color: #00008B;"/> </listitem> </listbox> </bandpopup> </bandbox>

    --This is how I populate my data:

    private ListModelList<statelist> rsStateAbbrList;

    public void doBeforeComposeChildren public void doBeforeComposeChildren(Component comp) throws Exception { super.doBeforeComposeChildren(comp);
    StateData getStateTypeData = new StateData();
    rsStateAbbrList = getStateTypeData.getStateDataList();
    comp.setAttribute("rsStateTypeList", rsStateAbbrList);

}


@Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp);

 /* select first item **/

 rsStateAbbrList.addToSelection(rsStateAbbrList.get(0));

}

--2.22.2019 update:

It did select the first item; however, it did not display the text instead it displays the object list ex."lmarsFormsDAO.StateList@13accb6".

Here is zul file.

bandbox id="statebandbox"
listbox id="rsStateListBox" onSelect="rsStateTypeID.value = self.selectedItem.label;rsStateTypeID.close();" checkmark="true" selectedItem="@{RS.getStatename}"

listitem self="@{each='RS}" value="@{RS.getStateAbbr}"
listcell label="@{RS.getStatename}"


..doAfterCompose(Component comp) throws Exceptions{
super.doAFtercompose(comp)
/**************** Load State and Set Default State **************/ StateData getStateTypeData = new StateData();
ListModelList<statelist> rsStateAbbrList
StateData(); this.rsStateModel = new ListModelList(getStateTypeData.getStateDataList());
ListModelList(getStateTypeData.getStateDataList()); rsStateModel.addToSelection(rsStateModel.get(0)); //this.rsStateListBox.setModel(rsStateModel); comp.setAttribute("rsStateModel", rsStateModel);

...

rsStateAbbrList.addToSelection(rsStateAbbrList.get(0));
this.rsStateListBox.setModel(rsStateAbbrList);

select first item in listbox using MVC not working.

<bandbox id="rsStateTypeID" autodrop="true" sclass="labelstyleDetail" style="font-weight:plain; font-size:11pt; color: #00008B; " hflex="1" mold="rounded"> mold="rounded"> <bandpopup height="100%" sclass="labelstyle" width="280px"> width="280px"> <listbox id="rsStateListBox" width="250px" hflex="true" mold="paging" pagesize="5" model="@{rsStateModel}" selecteditem="@{RS.getStatename}" onselect="rsStateTypeID.value = self.selectedItem.label;rsStateTypeID.close();" checkmark="true"> <listhead> <listheader label="State Selection"/> </listhead> <listitem self="@{each='RS'}" value="@{RS.getFcst_sensor_id} "> <listcell label="@{RS.getStatename}" style="font-weight:plain; font-size:9pt; color: #00008B;"/> </listitem> </listbox> </bandpopup> </bandbox>

public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp);

     /****************  Load State and Set Default State **************/
     StateData getStateTypeData = new StateData();
     this.rsStateModel = new ListModelList(getStateTypeData.getStateDataList());
     rsStateModel.addToSelection(rsStateModel.get(0));
     //this.rsStateListBox.setModel(rsStateModel);
    comp.setAttribute("rsStateModel", rsStateModel);

...

select first item in listbox using MVC not working.

<bandbox id="rsStateTypeID" autodrop="true" sclass="labelstyleDetail" style="font-weight:plain; font-size:11pt; color: #00008B; " hflex="1" mold="rounded">
<bandpopup height="100%" sclass="labelstyle" width="280px">
<listbox id="rsStateListBox" width="250px" hflex="true" mold="paging" pagesize="5" model="@{rsStateModel}" selecteditem="@{RS.getStatename}" onselect="rsStateTypeID.value = self.selectedItem.label;rsStateTypeID.close();" checkmark="true"> checkmark="true">
<listhead> <listheader label="State Selection"/> Selection"/>
</listhead> <listitem self="@{each='RS'}" value="@{RS.getFcst_sensor_id} ">
<listcell label="@{RS.getStatename}" style="font-weight:plain; font-size:9pt; color: #00008B;"/> label="@{RS.getStatename}"/>
</listitem> </listbox> </bandpopup> </bandbox>

public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp);

     /****************  Load State and Set Default State **************/
     StateData getStateTypeData = new StateData();
     this.rsStateModel = new ListModelList(getStateTypeData.getStateDataList());
     rsStateModel.addToSelection(rsStateModel.get(0));
     //this.rsStateListBox.setModel(rsStateModel);
    comp.setAttribute("rsStateModel", rsStateModel);

...

select first item in listbox using MVC not working.

<bandbox id="rsStateTypeID" autodrop="true" sclass="labelstyleDetail" style="font-weight:plain; font-size:11pt; color: #00008B; " hflex="1" mold="rounded">
<bandpopup height="100%" sclass="labelstyle" width="280px">
<listbox id="rsStateListBox" width="250px" hflex="true" mold="paging" pagesize="5" model="@{rsStateModel}" selecteditem="@{RS.getStatename}" onselect="rsStateTypeID.value = self.selectedItem.label;rsStateTypeID.close();" checkmark="true">
<listhead> <listheader label="State Selection"/>
</listhead> <listitem self="@{each='RS'}" value="@{RS.getFcst_sensor_id} ">
<listcell label="@{RS.getStatename}"/>
</listitem> </listbox> </bandpopup> </bandbox>

public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp);

     /****************  Load State and Set Default State **************/
     StateData getStateTypeData = new StateData();
     this.rsStateModel = new ListModelList(getStateTypeData.getStateDataList());
     rsStateModel.addToSelection(rsStateModel.get(0));
     //this.rsStateListBox.setModel(rsStateModel);
    comp.setAttribute("rsStateModel", rsStateModel);

...

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