Welcome Guest Search | Active Topics | Sign In | Register

Grid control single quotes issue Options
Guest
Posted: Tuesday, February 2, 2010 12:10:22 PM
Rank: Guest
Groups: Guest

Joined: 5/27/2007
Posts: -34
Hi,

I am using the grid control in conjunction with Google maps. You have already been a massive help but I am stuck on one final aspect.

During a callback I am adding items to the grid via a javascript command. In part of this command I need to add a mouseover to the grid text in a cell and have it fire a javascript event. When this text is added server side it is fine.

When I add it (as I have to during the callback) in javascript something dodgy is happening when trying to escape quotes:

gridViewLiteral.Append("item.getCell(0).setValue('<a href=\'#\' onMouseOver=myTest(\'GMapmarker" + mkr.ID + "\');>Link text</a>');");

The above command is then being sent back to the grid except that it is not outputing correctly and causing the rest of the commands to the Google map to fail also. I would have expected to be able to escape single quote within the item.getcell(0).setValue but for some reason this is not working.

I have tested the above with a variable to the function instead (thus no need for the quotes) and this worked ok, so it is defintely something amis with the quotes.

Please could someone help?

Thanks.
Guest
Posted: Tuesday, February 2, 2010 12:31:54 PM
Rank: Guest
Groups: Guest

Joined: 5/27/2007
Posts: -34
Hi,

I've modified the script below as follows:

gridViewLiteral.Append("item.getCell(0).setValue('<a href=\"#\" onMouseOver=myTest(\"GMapmarker" + mkr.ID + "\");>Link text</a>');");

This has stopped the errors and makes sure that the javascript function has been called.

Not sure whether this is a control issue or not any more but....

The first time my page loads and the marker id is passed to the script everything works ok, the second time (when the code is added via javascript) the marker event does not fire.

Any help appreciated.
eo_support
Posted: Tuesday, February 2, 2010 12:49:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Your second solution makes perfect sense because if you just "unescape" your original text you will get the following JavaScript code:

item.getCell(0).setValue('<a href='#' onMouseOver=myTest('GMapmarker_id');>Link text</a>');

This is obviously invalid.

I don't know why your marker event does not fire (I have no clue how it supposes to fire). But I would think as soon as you avoid the quote problems the Grid should be clear.

Thanks!
Guest
Posted: Tuesday, February 2, 2010 1:54:04 PM
Rank: Guest
Groups: Guest

Joined: 5/27/2007
Posts: -34
Yep, the the quotes are now escaped correctly.

There is still something very wrong with the way the text is being added into the grid though.

This is working via a callback panel which clears the grid items out first. The grid items are added, I can fire the javascript event but the underlying GEvent.trigger code on the map is not firing.

I think the reason is that something is being added at the wrong stage of the cycle but I am unable to work out why.
eo_support
Posted: Tuesday, February 2, 2010 1:59:52 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We can't do much without seeting the code. If you can isolate it into a test page and send the code over we will be happy to take a look and see what we can find.

Thanks!
Guest
Posted: Tuesday, February 2, 2010 3:04:43 PM
Rank: Guest
Groups: Guest

Joined: 5/27/2007
Posts: -34
The project is database driven and has quite a few parts to it now.

Would it be possible for me to package the whole project + database up for you?

There is only one page in question and only two sub routines that require scrutiny.

Please could you let me know.

Thanks

eo_support
Posted: Tuesday, February 2, 2010 3:27:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We usually do not do that because without the problem being isolated, it would often cost us quite some resource to setup the environment, learn the basic flows/logic of your application and also potentially troubleshooting an error that actually lies somewhere else. Thus we almost always ask the problem to be isolated first.

Having that said if you are sure the problem is localized (even though not completely separated from the rest of the project), then we don't mind to take a look of those places to see what we can find. In that case you can send us the whole project with specific instruction on where to look as well as steps to reproduce. As to the database, it will be better if you can host the database and simply give us access to it. Database is not our area of expertise and we do not have all versions of database servers in house. So it will be much faster if we can access your database directly.

Thanks!
Guest
Posted: Tuesday, February 2, 2010 3:35:07 PM
Rank: Guest
Groups: Guest

Joined: 5/27/2007
Posts: -34
Hi,

Totally understand. Wasnt sure what your decision would be so I have created a new project which strips down where the problem is.

I need to comment the code to let you know where the problem ocurs after adding items to the grid. Should I zip the files and PM them to the admin address?

Thanks.
eo_support
Posted: Tuesday, February 2, 2010 3:40:03 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Yes. That will be great.

Thanks!
eo_support
Posted: Tuesday, February 2, 2010 6:19:10 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We have looked into the code you sent to us. It does not appear to have anything to do with us. In fact we were able to reproduce the same problem after removing all our controls and replace the Grid with a simple div, then change the code that updates the Grid to update the div's innerHTML directly. The same problem occurs after these changes. We have emailed you the changed code.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.