PDA

View Full Version : simulate chatroom with a grid



rballman
2 Jun 2009, 10:04 PM
OK so I was thinking of simulating a chatroom using a gridPanel. I created a simple array store and tied it to the grid. Then I created some functions that add new rows on-the-fly.

My question is this: is there a way to display the grid rows starting at the bottom instead of the top? For example, 1 row on the grid is displayed at the top. Is there a way to display it at the bottom and each new row will be added to the very bottom pushing the other rows up?

Also, is there a better way to simulate a chatroom?

Thanks!

evant
2 Jun 2009, 10:07 PM
A DataView would be much better suited for this kind of thing.

rballman
3 Jun 2009, 10:56 AM
Below is how I added a new row to the GridPanel which works:


grid.getStore().insert(0, new dataRecord({message: 'text here'}));

When I do the same for a DataView, I get a Firebug error:

dview.getStore is not a function

using the following code:


dview.getStore().insert(0, new dataRecord({message: 'text here'}));

rballman
3 Jun 2009, 11:03 AM
ok i used store.insert() instead of dview.getStore().insert()

not sure why it wouldnt work before but it does now