0

How to load data dynamically into YUIGrid

asked 2007-07-25 09:13:56 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: chungsinwei

Hi,

Tried both of the yuiextz examples and very impressed. Is it possible to load data dynamically into the Y-Grid? Thanks.

delete flag offensive retag edit

19 Replies

Sort by ยป oldest newest

answered 2007-07-25 09:36:38 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: jumperchen

Hi Sinwei,
Did you mean the model and the databind in Y-Grid?

/Jumper

link publish delete flag offensive edit

answered 2007-07-25 09:42:52 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: nalin1279

I chungsinwei.

I just saw the source code of the Ygrid 0.5.1, and i can not find any function or properties for add dynamically data in the Ygrid, like ajax grid in EXTJS demo.

So i think it is not yet implemented, but it need to be confirmed by jumperchen.

mickael

link publish delete flag offensive edit

answered 2007-07-25 11:59:45 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: nalin1279

chungsinwei,

u maybe can test something with y-grid if u want to use model and databind

U maybe can define a model and a rowRenderer and apply them to y-grid properties; i give u a sample code that u have to adapt for Y-grid :


//first define a rowRenderer
public class MyRowRenderer implements RowRenderer {
public void render(Row row, Object data) {
Toolbarbutton btn = new Toolbarbutton(); // replace it with child allowed by Y-row(ylabel, Ylistbox ...)
btn.setLabel(((DerivatedFuture)data).getInternalCode());
btn.setSclass("VolLink");
btn.setParent(row);
row.setAlign("center");
}
}

RowRenderer rowRenderer = new MyRowRenderer();

//then a model, in this example it's a static model, but we can imagine to call an ajax procedure

java.util.List futures = new java.util.ArrayList(); futures.add( // object ); ListModel model = new SimpleListModel(futures.toArray());


// then in ure zul file :
<grid id="gridDerivative" style="margin-left:15px;margin-right:2px;margin-top:2px;"
model="${model}" rowRenderer="${rowRenderer}" height="160px" width="96%"/>

I think it's possible to adapt this for Y-grid but still dont test it !

Let me know if u test it and if it work.

mickael



link publish delete flag offensive edit

answered 2007-07-25 13:14:25 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: nalin1279

I'm back

Sorry it was a bad way, i just test it, but method setModel is not found in class org.zkforge.yuiext.grid.Grid.

I can not help u anymore... sorry !

mickael

link publish delete flag offensive edit

answered 2007-07-25 14:47:07 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: jumperchen

Hi Mickael,

They are not implemented in Y-Grid, and this feature is in the Feature-Requests yet. - http://sourceforge.net/tracker/index.php?func=detail&aid=1757381&group_id
=152762&atid=785194

Maybe I need to consider this feature's priority.

Cheers,
Jumper

link publish delete flag offensive edit

answered 2007-07-25 17:35:23 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: madruga0315

Live data with Y-Grid would be great.

Im waiting for this feature to be avaiable.

Thank you guys for ZK, itt just great.

link publish delete flag offensive edit

answered 2007-07-26 01:08:21 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: chungsinwei

Mickael,

Thanks for sharing your attempt. Hope can see this feature implemented soon in ZK.

link publish delete flag offensive edit

answered 2007-08-16 20:53:58 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: jeveloper

Hi

Since the last post YUI grid was altered and now had a property Model.
Although i have a question for ZK team.

I am trying to bind either a List units = new ArrayList() populated with Objects of a custom class.

<y:grid id="gr" model="@{units}" height="200px">

I also tried this:

ListModel model = new ListModelList(myObjs);


<y:grid id="gr" model="@{model}" height="200px">

<y:columns>
<y:column label="Date" />
<y:column label="Signed Up"/>
</y:columns>
<y:rows>

<y:row self="@{each=unit}">
<y:label value="@{unit.date}"/>
<y:label value="@{unit.units}"/>
</y:row>
</y:rows>
</y:grid>


I also do not know but in the second case where i use ListModel , the page in the grid shows either nothing ( no items) or instead of properties Java Object addresses.

Let me know if any of you have suggestions.

Thank you very much for any help.


link publish delete flag offensive edit

answered 2007-08-17 01:59:02 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: jumperchen

Hi Serge,

You can specify the class name of the converter that implments the TypeConverter interface. It is used to convert the value between component attribute and bean field. Multiple definition is NOT allowed and the later defined would override the previous defined one. Most of the time you don't have to specify this since this DataBinder supports converting most commonly used types. However, if you specify the TypeConverter class name, this DataBinder will new an instance and use it to cast the class.

The TypeConverter API
- http://www.zkoss.org/javadoc/2.4.1/zkplus/org/zkoss/zkplus/databind/TypeConver
ter.html

Hope that this can help you,
/Jumper

link publish delete flag offensive edit

answered 2007-08-17 02:29:37 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: jeveloper

Hi

Thanks for the response.
Where would i specify this classname? As you can i am using YUI grid component.

Can you provide a small example of how to implement such an interface?

I wonder why it happened to my class, it contains 2 simple properties , 1 of type Date and the other of type int.

Would you suggest changing the types for the ZK to be able to read it normally?

Thank you

Serge

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-07-25 09:13:56 +0800

Seen: 170 times

Last updated: Aug 21 '07

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