Monday, June 3, 2013

Zk Delete Selected Item from Listbox

As today i am trying to answer someone question in ZK forum how we can delete selected item or items from the Listbox i have created a demo example for this ...
Java Code for this
And ZUL Code for this Example..

You can ask more question in comment section :)

21 comments:

  1. Good one. Do you have any example for ZK MVVM Dynamic listbox

    ReplyDelete
    Replies
    1. This is MVVM Example I did not get your point about Dynamic Listbox ? Are you looking something like this http://zkframeworkhint.blogspot.in/2013/06/zk-delete-selected-item-from-listbox.html

      Delete
    2. Ok i will explain about dynamic. Many places i want to give the look up for the master record to select in the detail.

      For example, in the user personel page, i want to give the state lookup to select the state. Similarly, i want to show the look up for the insurance to select. So instead of creating seperate zul/vm for each lookup, i am trying to make it general. You got it now ?

      Delete
    3. Yes i have done this type of thing like When You will Select a State all District inside that State will be loaded into the DIstrict DropDown if this is requirmnet are you using Listbox for this?

      Delete
  2. yes. But not the drop down. Let me explain again. Assume that user want to select Insurance type in the details and also we have insurance type master which contains some 1000 records.

    So in the detail page, normally, we will give one read only text box for insurance type and next to that, we will give button. On clicking of the Button, we will open a modal window which will display all the insurance type in the listbox, now the user will select any one of the insurance type and then we will close the model window and populate the selected value in the read only text area.

    ReplyDelete
    Replies
    1. Yes i have done this but we used different Modal Class for modal Window because we mainly focus on the reusability of modal window.If you want this kind of thing its very easily can be done in the ZK MVVM .Mainly we can do this with the help of CreateComponent onclick on the detail open a modal window AND pass the object which contain insurance type with the help of insurance type get all the list and show in modal window now select any type and update that object it will automatically update your main window object if you need detail clarification i will explain you again

      Delete
    2. You catch my point of reusability, So here, the same model window will be used to show insurance type at one place and in another place, the same window will be show countries and so on. So now we have need to build the column header dynamically and the listcell should also be dynamic.

      Delete
    3. Yes you are right ,but can you please let me know how can i help you do you need my help on creating modal window and showing all the list?

      Delete
    4. are ou able to resolve this ZK modal window issue?

      Delete
  3. yes. basically, string will comma separated column header names and array of list of objects. So just passing this two parameter, the reusable component should create the column and fill the list.


    ZK Modal window issue ? Are you talking about finding MVVM Way to close the window by clicking a button ? if so, no.

    ReplyDelete
    Replies
    1. No i am asking about the issue to show modal window with details values and select one value and update main window which you previously mentioned . And closing a modal window i generally used in MVVM
      public void closeModal(@ContextParam(ContextType.VIEW) Component view){
      view.detach();
      }

      Delete
  4. Oh i am still in old way. Wire the window id in VM and use win.detach.

    Can you please give me example for the below

    String will comma separated column header names and array of list of objects. So just passing this two parameter, the reusable component should create the column and fill the list.

    ReplyDelete
    Replies
    1. You can check this http://zkframeworkhint.blogspot.in/2013/04/zk-detach-modalwindow-without-wiring.html may be this help you to how to close modal window in MVVM? Alos you wrote String is comma separated column header names .. Which i am not able to understand .One more thing i have to ask Did you able to show details about any column in modal window which was your first question here in blog?

      Delete
  5. How to get window state in zk. can you help me?

    ReplyDelete
    Replies
    1. I did not Get your question? Window State mean Window Object in ViewModel? or something else Please elobrate

      Delete
    2. first get windows object then save its in file. when windows load in another time then initial the object in window. is it possible?

      Delete
    3. Yes its possible But what is the Use of this ? It will little bit tricky because you have to load the Whole Window which can contain other component as well Its not looking good idea to put Window Component in the File.

      Delete
    4. Please give me any example.

      Delete
  6. what is the class ListboxViewModel in the above example

    ReplyDelete
  7. Hi can you please share example regarding how to disable or grey out the check box on some condition.

    ReplyDelete
  8. Hi can you please share example regarding how to disable or grey out the check box on some condition.

    ReplyDelete