We managed to bind an object to the grid. One of the properties of the object is a string that contains xml. This xml contains some detail information that the users might want to view. With templating we managed to show an icon in case the template is present, like this:
<td> {{if ${Template} !=""None""}} <input type=""image"" src=""../Resources/MagnifyingGlass.png"" align=""left"" onclick=""popUp(${Template});""/> {{/if}} </td>
In this case ${Template} is the string that contains the xml.
This does work fine in Firefox. When the image gets pressed the javascript gets executed and details are shown to the user. However in IE we get the exclamation sign stating that the page loaded with errors. While at first glance everything seems to have loaded with no problems we are unable to click the button that will show us the detail information.
When I place an imagebutton like the one on the grid directly on the page there is no problem with the execution, so my guess is that there is something up with the combination of the xml, the row templating and IE. Do you have any clue what might be up here?
PS.
The xml that we use for testing looks like this:
<Template> <Description>This is a test</Description> <Field> <Label>TestLabel</Label> <Content>This is a test</Content> </Field></Template>
Hi,Truth be told, I'm surprised that you were able get this scenario to work - it's not a simple one.First off, can you please click on the yellow exclamation mark in IE - it will bring up a popup window with the error that has occurred on the page?Second, can you please provide us with a sample where we can reproduce the scenario (HTML if possible)?Given the details you provided (the template for the Template cell and its value) - thanks for those! - I couldn't get my HTML sample to work under Firefox and under IE I got the following error when clicking on the image:
So I decided that as an alternative to XML I could use JSON, but that required a few tweaks as well.As a first step, I am using a 3rd party JavaScript library that lets me convert XML to JSON (http://code.google.com/p/x2js/).
Second, ended up putting the value of the Template object into a data-value attribute and I assigned a click handler for the image using jQuery. The cool thing is that using the browser-embedded JSON.parse() and JSON.stringify() functions I am able to switch the data from a string to an object and vice versa.Hope the sample I've attached to this reply will be of use to you.Cheers!Borislav
Since I see an error from toString I might need to clarify that the property we bind to the grid is of the type string. It is just filled with xml, so in my opinion no toString call would need to be made.
We want to pass this string into a javascript function that generates the html for the detail view we want (and this works with Firefox).
The error we get with IE is very non-descriptive (at least to me). Webpage error detailsUser Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)Timestamp: Tue, 29 May 2012 13:27:16 UTCMessage: Syntax errorLine: 1Char: 7Code: 0URI: http://localhost:2764/patient/getpatientlistI am not sure if it is any help, but the icon only appears after expanding the grid (the button to view the details is place on the level that expands).
I will look into getting a sample with this behaviour.
I have a sample that will show the behaviour exactly as I described.
A-ha!Thank you very much for the sample - I wish all asking people on the forums could provide samples like yours (nope, not on VB, but with sufficient details to reproduce the problem :)) So, here's the problem: as soon as the child grid begins to render (when you expand a root grid row), this is the onclick for the TemplateXML column:
popUp(<Template> <Description>This is a test</Description> <Field> <Label>TestLabel</Label> <Content>This is a test</Content> </Field> </Template>);
Now, Firefox lets you get away with this, but IE is much more strict and says "hey, this isn't a single-line Javascript code - it has new lines in it and it's not a string as well - what are you trying to do?!"Now, the problem comes from your data - even before it can be manipulated by the igGrid (by using a formatter function for example), the syntax error is already thrown by IE.What I can recommend is to cast the TemplateXML column's data to string and to remove allnew line characters from it on the client side. I'm no VB expert so I'll just keep my fingers crossed - feel free to provide me with an update to your solution if this suggestion doesn't work out.
No problem. Talking about a good sample makes it easier for both of us :). (You might also like to know that we will be switching to C# during this year, so it will even get better :)).
I tried what you suggested, but it does not seem to help as the same error still occurs. But your suggestion got me thinking and my guess is the IE tries to interpret the XML as if it is part of the HTML, since it encounters a "<". So maybe it might not be possible to pass XML along like that at all in IE.
I should tell you that I'm mostly kidding about VB ;) - sure, it's hard for me to understand, but it's your language of choice and I respect that.About the XML and IE - I can tell you for sure the this works in all browsers (IE included):
popUp('<Template><Description>This is a test</Description><Field><Label>TestLabel</Label><Content>This is a test</Content></Field></Template>');
In my personal opinion, if you can get your server-side to generate this into the page's source code, you will have a solution to your problem.
Cheers!Borislav