Question

I am creating 2 ListBox in my Java code using ZK and assigning those ListBox unique Ids.This is my flow.

  1. Customer select values from the drop box.
  2. Hit Save button
  3. Values passes to Underlying Service and status got update.
  4. We refresh page with help of another event.

Here is how I am creating Listbox

Listbox listbox=createListbox(widget,OrderStatus.ORDERSTATUS.class, null,orderStatus);
listbox.setId(ORDER_STATUS_ID);

Everything is working fine for the first time, but when I am doing it next time, though underlying code is working fine but I am getting following error message for second time and so on.

Not unique in the new ID space: orderStatusId

Issue is related to enter link description here but being new to ZK not sure what can be best way to achieve that. For me issue seems when We are refreshing page after successful order status update, as code is being executed again and seems it has already that Id assign to it.

Page Refresh Code

 button.addEventListener("onClick", new EventListener()
    {
      public void onEvent(Event event)
        throws Exception
      {
        DetailsWidgetRenderer.this.handleRefreshEvent(widget, event);
      }
    });
Était-ce utile?

La solution

A common mistake when using ZK is to stay in the request/response cycle in your head. ZK doesn't do request/response cycle. Forget about it. ZK is like Swing: You create the UI, you put your data in models and then let the framework render everything.

In your case, you probably try to add the ListBox to the UI again (because that's what you're used to from JSPs). Don't do that. Just update the models which are attached to the ListBox and ZK will refresh the HTML for you.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top