Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by James Snyder on Apr 07, 2009 13:39
open dhtmlx forum
dhtmlxGrid +AddRow +alt +javascript

I am attempting to add a row with a javascript "onClick" event and an alt tag for the image.

I found this answer on your site but could not make it work for me. I'm obviously doing something wrong... I just cannot figure out what.
http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=2220&ssr=yes&s=addrow%20img%20alt

This line works
grdFavorites.addRow(iIndex," · "+sRestaurant+",images/Favorite_Order.jpg");


This line does not. I have tried several variants on this but with no luck
grdFavorites.addRow(iIndex," · "+sRestaurant+",<img src=images/Favorite_Order.jpg />");
grdFavorites.addRow(iIndex," · "+sRestaurant+",<img src='images/Favorite_Order.jpg' />"); //single quote


Thanks for any help.
James
Answer posted by dhxSupport on Apr 08, 2009 01:10

Try to do the following:

grdFavorites.addRow(iIndex,[" · "+sRestaurant,"<img src='images/Favorite_Order.jpg' />"]);

Second parameter of addRow method - array of row's values: ["value for the first cell","value fo the second cell","<img src='some.gif' />"]

Answer posted by James Snyder on Apr 08, 2009 10:36

Thanks for the help.  There was a small issue with where the quote started

The answer was posted as:
grdFavorites.addRow(iIndex,[" · "+sRestaurant,"<img src='images/Favorite_Order.jpg' />"]);

This is the correct one
grdFavorites.addRow((iRow +1),[" &middot; "+sRestaurant+",<img src='images/Favorite_Order.jpg' />"]);

What was missing was the +",  after sRestaurant.  The quote was after the comma instead of before it.   Thank you again for the help!!