0

implement grid with javascript

asked 2012-02-19 19:32:13 +0800

ToniGomez gravatar image ToniGomez
15

I need an example of implementation a grid with javascript. Is it posible?

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2012-02-20 00:59:06 +0800

RichardL gravatar image RichardL
768 4

What's your use case? What javascript do you need?

link publish delete flag offensive edit

answered 2012-02-20 08:13:17 +0800

ToniGomez gravatar image ToniGomez
15

I'm developing a financial web. I need to show market information every 250ms, so I need to process the information in client side.

In my case. I've an array of objects in javascript and I want to add every row to a grid.

For example:
<script type="text/javascript">
function StockItem(quote, name) {
this.Quote = quote;
this.Name = name;
}

var newSt = new StockItem("1", "Test");

<script type="text/javascript">

I want to add a row with newSt

link publish delete flag offensive edit

answered 2012-02-20 12:52:47 +0800

RichardL gravatar image RichardL
768 4

You could build a grid using native components - check firebug for all the dom elements and styling you need. Then, use jquery to insert the row (tr element). Bear in mind that you wouldn't have paging or sorting in the grid.

link publish delete flag offensive edit

answered 2012-02-20 15:09:45 +0800

ToniGomez gravatar image ToniGomez
15

updated 2012-02-20 15:13:05 +0800

ok, I need some help. For example to add a row to this grid? Normaly after row I'll add something like append("<tr><td>row content</td></tr>"). Could you help me?

<zk xmlns:w="http://www.zkoss.org/2005/zk/client" >
<window title="Hello!" width="550px" height="300px" border="normal">
<grid id="g" width="200px" >
<columns id="cols">
<column id="col1">column1</column>
<column id="col2">column2</column>
</columns>
<rows id="rows">
<zscript>
String[] x = new String[1];
</zscript>
<row forEach="${x}">
<label value="x${forEachStatus.index}"></label>
<label value="y${forEachStatus.index}"></label>
</row>
</rows>
</grid>
<script type="text/javascript">
function addRow(){
var row = zk.Widget.$('$rows')
}
</script>
</window>
<button label="addRow" w:onClick='addRow()'></button>

</zk>

link publish delete flag offensive edit

answered 2012-02-20 15:30:00 +0800

RichardL gravatar image RichardL
768 4

Hi,
Your using a regular ZK component, not a native one. See here: :http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/UI_Patterns/HTML_Tags/The_native_Namespace

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: 2012-02-19 19:32:13 +0800

Seen: 136 times

Last updated: Feb 20 '12

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