Skip to main content

Dojo Etable and crud operations

3 replies [Last post]
jenniferb
Offline
Joined: 2004-04-02
Points: 0

Hi

Has anyone tried to work with Dojo etable in terms of doing basic crud with it?

For example, when I want to load new data into the table as a result of some action, I understand I need to provide the Ajax code to do that, but then how do I re-render the table with the new data? All I can think of is to set the data on the server using Ajax and call the table's render function and expect it to retrieve the new data. Is this the recommended way?

Another thing I need to do is have a column of checkboxes in the table so that I can select a row and delete it. Has anyone tried this? I'm not even sure how I'd go about doing this.

Thanks in advance for your help.
Jennifer

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31
Points: 0

The table cells are set using innerHTML so you could attach events to a checkbox and this would work.

The Ext Grid which you can find here:

https://widgets.dev.java.net/servlets/ProjectDocumentList?folderID=7043&...

Has built in support for cell renderers and in the case of a boolean value automatically has a checkbox.

I suggest you give it a look.

You can use the library by placing the content from the Ext zip file /resources directory under the resources directory of yoru web app or if you are using Netbeans Add the Widget Library as described at:

http://weblogs.java.net/blog/ludo/archive/2007/01/extending_the_j.html

jenniferb
Offline
Joined: 2004-04-02
Points: 0

Thanks for the info. I will look into it. I'm not sure if I can use that widget for my purposes.

Back to the etable widget: How do I re-render the table so that it can pick up new data on the server?

I want the value selected from a combobox to change the data on the server and re-render the table. Shouldn't the following glue code work, assuming that the combobox uses the topic /dojo/combobox/track and the table has the id, sessionData?

jmaki.addGlueListener {
topic: "/dojo/combobox/track",
action: "call",
target: {object:"jmaki.listeners.ComboboxTable",
function:"updateTableHandler"}
});

jmaki.listeners.ComboboxTable = {
updateTableHandler : function(value) {
dojo.io.bind({
url:jmaki.webRoot+"/attendee/compute?track="+value,
method:"get",
mimetype:"text/json",
load: function(type, data) {
var _thisTable = jmaki.attributes.get('sessionData');
_thisTable.render();
}
});
}

I am using this with Phobos, by the way. And I've tested my URL, and it gives me the correct data back, but for some reason, the load callback function is not getting called.

Any ideas?

Thanks.
Jennifer

yummychen
Offline
Joined: 2008-04-07
Points: 0

Dear Jennifer :

Can you access datas of the etable ? I want to use the etable to do some crud operations, but i can't get the value in the tables. Because i got an object via the args.value method. Do you know how to get the value in the cell?

jmaki.listeners = {
etableListener : function(args) {
alert(args.targetId);
alert(args.value);
}
}