zk listbox not rendering

asked 2024-03-26 23:55:05 +0800

NishaBelgi gravatar image NishaBelgi

I upgraded to version and I am using the zk-legacy packages for data binders. One issue I am having is that a listbox is not rendering even though the model object has been updated. This happens randomly. If I refresh the page using browser refresh, the listbox renders. Any ideas on what could be wrong is appreciated.

in zul: <listbox id="rulesListBox" vflex="1" width="100%" span="true" multiple="true" emptymessage="loading...">

In the controller, I tried rulesListBox.renderAll() after setting the model data, still it is not rendering.

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted

answered 2024-03-28 12:18:09 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

a listbox is not rendering even though the model object has been updated..

Do you mean, e.g. you click a button to update the model, but the Listbox doesn't render the updated model?

If so, please debug by following https://www.zkoss.org/wiki/ZKDeveloper%27sReference/Debugging first. Please share us more details. Thanks.

link publish delete flag offensive edit


Please see below... I have explained further as an answer because of limited characters allowed here in comment.

NishaBelgi ( 2024-04-02 22:25:33 +0800 )edit

answered 2024-04-02 22:24:48 +0800

NishaBelgi gravatar image NishaBelgi

Thank you for the response. The issue is not when the user clicks a button, but on the asynchronous change of the model by the controller after displaying the initial screen. I will try to explain the flow below:

Upon getting redirected to the "zul" file, the controller starts a DesktopEventQueue like below:

DesktopEventQueue<Event> eventQueue = new DesktopEventQueue<Event>();
eventQueue.subscribe(new QueueListener(), new QueueCallback());
eventQueue.publish(new Event(ASYNC_EVENT_ON_LOAD, null, data));

The screen is displayed witht the message "loading..."

The "QueueListener" asynchronously loads the data required for the screen. After the load is done, the "QueueCallBack" updates the model with the required data. The listbox on the screen should display the updated model data, but it does not do so, at first. If I refresh the screen using browser refresh, basicallty doing the whole process above again, the data displays.

The model class is a sub-class of the org.zkoss.zul.ListModelList class.

I also noticed that I can even just "resize" the window and the data appears!. I can see from "Developer Tools" that data got loaded by "zkau" request when I resize the window. Also, the server-side processes appear to work exactly as before, based on logs.

This code was working fine till version, I am trying to upgrade to version as part of our server upgrade to WildFly 31. I am using the "zkplus-legacy" jar files for the deprecated classes.

Any help or pointers is appreciated.

link publish delete flag offensive edit


I create an example according to your description: https://zkfiddle.org/sample/3f17jad/1-listbox-not-rendering#source-1 I run it and can get expected result, please try it or modify it to your real case.

hawk ( 2024-04-03 11:53:30 +0800 )edit

it's better to provide a reproducible, running example, so we can debug it more efficiently

hawk ( 2024-04-08 09:17:31 +0800 )edit

answered 2024-04-15 09:22:55 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

you can check the zkau response in browser developer tool, if the response doesn't contain the data to render, it's server side issue. If it contains the data to render, but the listbox doesn't render it, it could probably a bug. You can try to upgrade to the latest 9.6.5 to see if it's fixed.

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




Asked: 2024-03-26 23:55:05 +0800

Seen: 11 times

Last updated: Apr 15

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