0

How to clear all rows from a grid?

asked 2008-11-10 08:10:52 +0800

davout gravatar image davout
1435 3 18

I can't find a method that clears all rows from a grid.... is there?

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2008-11-10 08:22:16 +0800

ziccardi gravatar image ziccardi
321 7

updated 2008-11-10 11:22:37 +0800

I would remove the rows component and I would replace it with e new one, or, if you use a Model, simply replace the model with an empty one.

Look the following example:

<window title="My First Window" border="normal" width="200px">
<vbox>
<grid id="mygrid">
   <columns>
        <column label="COL1"/>
   </columns>
   <rows id="gridRows">
      <row>
            ROW1
      </row>
      <row>
            ROW2
      </row>
   </rows>
</grid>
<button label="Click Here">
    <attribute name="onClick">
        mygrid.removeChild(gridRows);
        gridRows = new Rows();
        gridRows.setParent(mygrid);
    </attribute>
</button>
</vbox>
</window>

link publish delete flag offensive edit

answered 2008-11-11 15:58:07 +0800

davout gravatar image davout
1435 3 18

OK, I understand, but your response seems odd.

Why not simply have a grid.getRows().clear() method to do the same thing?

link publish delete flag offensive edit

answered 2008-11-11 17:06:10 +0800

ziccardi gravatar image ziccardi
321 7

Ask to ZK developers :-)

However, if you would use a model, you wouldn't need to clear the grid's rows, 'couse the grid content would reflect your model.
So, an empty grid should reflect an empty model...

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: 2008-11-10 08:10:52 +0800

Seen: 250 times

Last updated: Nov 11 '08

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