EasyUI Forum
April 25, 2024, 02:24:40 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Html escaping chars in Treegrid  (Read 12693 times)
TSDani
Newbie
*
Posts: 2


View Profile
« on: January 21, 2016, 06:41:44 AM »

Hi,

I have noticed that when you load data or even when you edit a cell data of a string typed column in a TreeGrid,
with this text "</" or any other text that starts with this char '<', leaves the cell empty!

If you inspect the cell in the html source in your web browser, you can see that the data of this cell is in a comment
<!-- </ -->

Any suggestion or idea how to solve this issue?

Thanks in advance.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: January 21, 2016, 08:10:33 AM »

You need to escape the inputed characters after editing a row. The code below shows how to achieve this functionality.
Code:
$('#tg').treegrid({
onEndEdit: function(row){
row.name = row.name.replace(/</g,'&lt;');
row.name = row.name.replace(/>/g,'&gt;');
}
})
Logged
TSDani
Newbie
*
Posts: 2


View Profile
« Reply #2 on: January 21, 2016, 08:25:34 AM »

Ok, that only covers the editing part.
What about loading data?
It means that I will need to scan my entire data on the way in and out of the treegrid for these chars?
(I need to return to the server "<" and not "&lt;")

I thought maybe column formatters can solve that.

thanks,
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: January 21, 2016, 03:28:03 PM »

You also can use the loadFilter function that allows you to convert the original dataset to treegrid rows.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!