0

AnnotateDataBinder and live data

asked 2007-04-27 18:44:59 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4284612

By: alexdusty

Hello,
I would like to use create a grid to navigate through a (very) big data set, and that's no problem implementing a custom data model and using pagination.
But this way I have to render the rows "by hand" coding a custom RowRenderer.

I would like to reach a similar result but by using Annotations for data binding so that I do not need to create the Row with code.
With the AnnotateDataBinder I can't provide any more a DataModel because it wants a List, Set or Map as a base object, so what can I do?

Maybe I could subclass (for example) a List? But this is much more demandind that simply implement the ListModel interface.

Someone has suggestions?

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2007-04-27 18:46:41 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4284613

By: alexdusty

Hello,
I would like to use create a grid to navigate through a (very) big data set, and that's no problem implementing a custom data model and using pagination.
But this way I have to render the rows "by hand" coding a custom RowRenderer.

I would like to reach a similar result but by using Annotations for data binding so that I do not need to create the Row with code.
With the AnnotateDataBinder I can't provide any more a DataModel because it wants a List, Set or Map as a base object, so what can I do?

Maybe I could subclass (for example) a List? But this is much more demandind that simply implement the ListModel interface.

Someone has suggestions?

P.S.: I'm sorry, I posted the message in the "install" forum, I reposted it here where it's more appropriate

link publish delete flag offensive edit

answered 2007-04-30 09:57:22 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4287395

By: robbiecheng


Would you please tell me about the data-type of your case?

/Robbie

link publish delete flag offensive edit

answered 2007-05-01 03:13:35 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4288644

By: henrichen

1. Implement a BindingListModel as you might have done.

2. "disable" the default ListModelConverter by specify a none there.

<a:bind model="your-model-class;converter:none"/>

/henri

P.S. I will allow ListModelConverter to accept BindingListModel as an input.
See this feature-request.

https://sourceforge.net/tracker/index.php?func=detail&aid=1710373&group_id=15276
2&atid=785194

link publish delete flag offensive edit

answered 2007-05-01 12:38:02 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4289131

By: alexdusty

Hello Henri and thanks for the reply.
I'll try your suggestions.

Another question: how may I trigger a refresh of the rows if the model changes?

In particular my windows does a search on a (big) table, and if the user changes the search criteria the grid (and/or a listbox) must reflect changes.

In traditional way I can issue a "setModel" to update the content, but with annotations is this possible?

Thanks,
Alex

link publish delete flag offensive edit

answered 2007-05-14 16:19:41 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4311386

By: simon_massey

Alex,

That is a good question. If you look at the foodToGo sample app here:

http://zkforge.svn.sourceforge.net/viewvc/zkforge/trunk/foodToGo/src/main/webapp
/zul/index.zul?revision=285&view=markup

then at line 34,35 you can see that we use binding annotations. Then at lines 57-60 post we refresh the list of POJOs from the database if the users hits the refresh button. Then we get the data bound model and do a removeAll followed by an addAll to put the new data into the list. In the cold light of day it should have been a clear then an addAll ;)

I am thinking that menu-items.zul should be refactored to use either bind annotations or a RowRenderer. Currently the app is going a crude <include> refresh...

Simon






link publish delete flag offensive edit

answered 2007-05-24 07:56:11 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4328068

By: devilgary

Another way I found which is working. In this example I use ListModelList but in the practice can be different depends of Collection data type you use. For example ListModelMap for Map type of object.

List dataList = .. //retrieve the data from somewhere


ListModelList modelList = (ListModelList) myListBox.getModel(); modelList.clear(); //clear all the contents of myListbox 1st modelList.addAll(dataList); //repopulating all data and myListbox should be refreshed with new data =)


I hope it helps.



Regards,


Gary Purnomosidi

link publish delete flag offensive edit

answered 2012-01-12 00:15:04 +0800

arscek gravatar image arscek
21

Hello, I'm sorry to reopen an old thread.
I'm new to ZK and I have a question about live data. I read through the documentation and as far as I understand, if I need more than one column, I must implement a rowrenderer or listitem renderer, but if I use the databinding annotations, I can use the properties of a bean to display my information. But I don't really need to data bind my model, I just use this listbox to display some results. Is there a problem if I use the databinding annotations instead of implementing a renderer and use live data?

link publish delete flag offensive edit

answered 2012-02-04 04:03:14 +0800

matthewgo gravatar image matthewgo
375

updated 2012-02-04 04:03:59 +0800

Hi arscek,
If you dont want to bind live data , please try using EL( ${} ) instead.

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2007-04-27 18:44:59 +0800

Seen: 1,676 times

Last updated: Feb 04 '12

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