This is a migrated thread and some comments may be shown as answers.

embedded <br> tag in the text value stored in the database

3 Answers 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim R
Top achievements
Rank 1
Tim R asked on 31 Jan 2013, 11:21 AM
The text in the database has some embedded line-break tags <br>:

                      The quick brown fox<br>jumped over the lazy dog

When my grid is instantiated for the first time, the text value displays so:                                          

                     The quick brown fox<br>jumped over the lazy dog

When my grid is instantiated on the page a second time (i.e. I fetch the data again from the server via my XHR and recreate the grid as if it had never existed -- it is not merely a rebind to the new data using the existing configuration), the text is rendered so:

                    The quick brown fox
                    jumped over the lazy dog


Happens in  IE, Chrome, FF, and Opera.  
But if I check to see whether the grid already exists, and if it does exist, I simply rebind the data without re-instantiating the grid, then the value is rendered so:

                  The quick brown fox<br>jumped over the lazy dog

   I am trying to figure out what is causing this behavior.
            

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 04 Feb 2013, 07:46 AM
Hello,

The HTML tags in the field value will be shown if it is encoded which is done by default. You can control whether the value will be encoded by using the column encoded configuration.
I am not sure could be causing the different in behaviors when creating the Grid again. Is the old Grid destroyed? Are you using a different configuration for the column?

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Tim R
Top achievements
Rank 1
answered on 04 Feb 2013, 02:03 PM
This was on a report where the encoded was default, i.e. not set to false, and the report was not destroyed between data refreshes. The dataSource has its data entirely replaced every minute with a new dataset with the same schema model.  Sometimes the rows are the exactly the same -- that is, no changes have occurred in the previous 60 seconds.  

I will go back and rewrite the code to destroy the grid each time. But I wanted to let you know of the behavior. It's as if the encoded property is being changed to false when dataSource.data(new dataset [with same schema model]) method is invoked more than once.
0
Daniel
Telerik team
answered on 06 Feb 2013, 08:42 AM
Hello Tim,

Initializing the Grid again on the same element will cause problems because the events of the old Grid are not unbound. You should either destroy the old Grid before creating the new one or if the data has the same structure, use the dataSource data method to set it.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Tim R
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Tim R
Top achievements
Rank 1
Share this question
or