1

Getting selected ListBox values on button Click | ZK

asked 2014-01-09 13:07:46 +0800

umeshawasthi gravatar image umeshawasthi
11 2

updated 2014-01-09 15:34:15 +0800

I am very new to ZK framework and trying to customize few things and have struck at one point which I am not sure how to achieve that.

I have a predefined section where I need to show 2 drop down and a button and need to persist those drop down values on button click event. This is how It has been define in Spring file

<bean id="mybean" parent="parentBean" class="WidgetRenderer">
   <property name="detailRenderer">
            <bean class="DetailsListRenderer" parent="abstractWidgetDetailRenderer"/>
   </property>
</bean>

Here mybean is being used to show main section and I am adding my drop down using this bean while button are being added to detailRenderer.

Save button is bind to onClick event, but I am not sure how I can fetch values from my custom drop down? I am aware about binding those Dropdown with onClick event but they have to be in same class.

Can any one suggest me how I can fetch values of those drop down.I am creating down down with following code

Listbox listbox = new Listbox();
listbox.appendItem("item1", "item1");
listbox.appendItem("item2", "item2");

This is my button code in another class

protected void createUpdateStatusButton(Widget widget,Div container)
 {
   Button button = new Button(LabelUtils.getLabel(widget, buttonLabelName, new Object[0]));
   button.setParent(container);
    button.addEventListener("onClick", new EventListener()
    {
      public void onEvent(Event event)throws Exception
       {
             MyClass.this.handleSaveStatusEvent(widget, event);
          }
    });
  }
delete flag offensive retag edit

Comments

Is there any chance you can modify things so that you use a ModelView architecture? If so I can try and help. Looks like you're creating all your components manually. Are you in a legacy code base?

rickcr ( 2014-01-09 19:43:16 +0800 )edit

@rickcr: I can modify few things in it..I am using an underlying framework so can not change many changes....You can suggest changes and I can try to include them.

umeshawasthi ( 2014-01-10 04:10:04 +0800 )edit

It will greate if u can use MVVM framework of ZK

sjoshi ( 2014-01-13 06:45:43 +0800 )edit

@sjoshi: can you point me to that?

umeshawasthi ( 2014-01-13 07:44:34 +0800 )edit
Be the first one to answer this question!
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: 2014-01-09 13:07:46 +0800

Seen: 22 times

Last updated: Jan 09 '14

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