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

grid loading json data from php datasource that contains html

2 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 09 Mar 2012, 05:09 PM
Ok, bear with me on this one. 

My grid is being populated by a basic php get request that pulls all records from the database. Basic, it works like a charm.
However, the content that is pulled from the db does contain html formatting. I can strip the html via php before it gets encoded into the json object (I've confirmed this does work) however, once it becomes json, the html tags are back and the grid displays all the content in a not so human friendly way.

so 2 questions...
1- is there a better way of getting rid of the html content in the json data, as it's not specifically necessary in the grid view but used elsewhere on the site it is so removing completely is not possible. 
2- or is there a way to get the html content to display in the grid?

Any help in a timely manner would be beneficial as I'm likely to drop using Kendoui at some point today as this has already cost me about a days worth of time. And I want to keep Kendo ;)

Thanks!

2 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 09 Mar 2012, 05:17 PM
Hi Jason,

I think that running strip_tags on the JSON string should do the trick.

All the best,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jason
Top achievements
Rank 1
answered on 09 Mar 2012, 05:28 PM
Petyo,

Thanks for the reply... altough it turned out a bit more convoluted than just doing strip tags on the json object, essentially that is all I needed to do. Still doesn't explain why the striped html content came back once json encoded. But, it works, so I don't care too much. I get to keep using Kendoui now :)

This solved the issue:
strip_tags(htmlspecialchars_decode(stripslashes($this->jsonData)))

- Jason
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Jason
Top achievements
Rank 1
Share this question
or