Skip to main content

Add data into etable

8 replies [Last post]
mk_hh
Offline
Joined: 2007-06-26

Hello,

I use one jsp page as a service for etable.
This service.jsp generates data and writes it in json format. It works. I see the genarated data in the table.

I have one addRow Button. If I press this button, the service.jsp should generate new data including new row and write it into the etable.The data is correct and includes the new row.

The problem is, that the etable isn't updated and doesn't show me the new data, only old rows without new one .

What should I do, to update the table?

Thanks in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ehi
Offline
Joined: 2007-08-16

Hi, could you please show some sample code on how this is pushed back to the server.
I can't see the full picture on what needs to happen on the server side to handle the update.

mk_hh
Offline
Joined: 2007-06-26

I don't really understand, what you want to see. My scenario or how do addRow and removeRow evens work?

noktanet
Offline
Joined: 2006-04-23

Hi,
I investigate jmaki to use with Java EE Applications. My question is about "how to use etable" and "how to update database after editing table". I'd like to have information about this.

Best Regards

gmurray71
Offline
Joined: 2003-07-31

Hi,

The table is wired to only pull in new data when the widget is created via the service. You are going to need to have JavaScript on the client to update the table. This of course could push data back to the server.

The easiest way to do this today is to get a handle on the widget instance and call a function on it:

In your glue you can do the following based on an event.

I put this in the glue.js and mapped it to a button press event.

var table = jmaki.getWidget("mytable");
table.addRow( ['Ajax with Java', 'Jean Bean','4413', 'Some long description']);

We plan to have subscribe events for manipulation in the near future as we really want to be doing this using publish /subscribe in the near future.

Let us know if this does not work for you.

mk_hh
Offline
Joined: 2007-06-26

Unfortunately, it doesn't work for me.
My client doesn't know, how the rows look like. The server generates new data and saves it. Because of this, I cann't use table.addRow(...) on the client

e.g my start point after the first data was generated from server

Column 1 | Column 2 | Column 3
-----------------------------------------------
A | B | C
D | F | E
F | S | Q

after I pressed the addRow button, the server generates new date (it works) and the should look like e.g.

Column 1 | Column 2 | Column 3
-----------------------------------------------
A | B | C
D | F | E
F | S | Q
[b] G | M | I[/b]

But my client doesn't know, that it should add a row ( 'G', 'M', 'I' ). The data is very generic.

Is the service problem only with etable or with easy table to? It looks like, you have problem with service by many components(e.g Ext.tree doesn't show a title of the root node, if you use service.)

Where can I find more information about components? e.g which properties can I set? Which events do the components support?

mk_hh
Offline
Joined: 2007-06-26

How can I update the table view, if the data was changed? It should be possible.

gmurray71
Offline
Joined: 2003-07-31

Hi mk_hh,

We have a wiki page set up on the different things you can do with a dataTable. See:

http://wiki.java.net/bin/view/Projects/jMakiTableDataModel

You can use an array of objects that has the associations with column ids which should allow what you need. Alternatively you can also have the server render the column names as part of the value. Both cases are detailed on the wiki page.

Which model do you prefer: Array of Arrays or Array of Objects? The first requires more work on the behalf of the user but the second allows for more flexibility. In the end I think the array of objects is better but I'd like to hear your opinion.

mk_hh
Offline
Joined: 2007-06-26

Hi gmurry71,

My service.jsp generates the data as Array of Arrays.

My question is (see above), how can I update a table, if I need this.