3.0.4

Adding image with a onclick event

All,

I am a complete new to javascript (but not to PHP and HTML).
What i try to accomplish is the following:
Read my data from a mysql table into a javascript array .
Next i like to add two columns with an edit icon and a delete icon.
Both images will have an onclick event popping up an other window with an edit form or confirm message.

The access to the mysql works but I like some help in adding the two additional rows with an clickable image.

Anybody have some examples or hints where i can find some information.

Thanks in advance

KArel

BTW I am aware that you can make the grid itself editable but that is not what i am after.

Karel Bokhorst
May 21,
The access to the mysql works but I like some help in adding the two additional rows with an clickable image.
^ this means 2 additional columns? if so...
self.insertcolumns = function () {
var allrows = document.getElementsByTagName('TR');
for (var i=0;i<allrows.length;i++) {
var newtd = document.createElement('TD');
var button = document.createElement('INPUT')
button.setAttribute('type','button')
button.setAttribute('value','edit')
button.onclick = function () { alert('edit')}
newtd.appendChild(button)
allrows[i].appendChild(newtd)
}
}
if you add this function and then do something like <a onclick="insertcolumns()">work damn it..</a> in body of html it should add edit button (that does absolutely nothing) to all rows of all existing tables...
Gene D.
May 23,
Here is a wonderfully working demo by Sudhaker Raj.

http://thej2ee.com/tutorial.item.2/awgrid-gpl-row-editing-using-popup.html

Hmm, I note that the site is throwing up an error right now, but, you know, I even saw this page working three days back.

Meanwhile, there are several other working demos in here:
http://friendsofaw.com/nuke/modules.php?name=Demos

Keep trying the first link, thats what you were exactly looking for (but in J2EE, of course) with nice add/edit/delete popup forms. The grid is kept disabled until these forms are dismissed.

Hope this helps!

Neo
Neo (TrioteX)
May 26,
Take a look at his post here:

http://www.activewidgets.com/javascript.forum.19163.6/record-level-editing-using-popup.html

Cheers,
Neo
Neo (TrioteX)
May 26,

This topic is archived.

See also:


Back to support forum