Hi :) ,
i'm trying to display my string with json but i'm seeing the tag <br/> instead of the line break:
what i expected:
" this is a
line break"
what i see:
"this is a<br/>line break"
on my document I've write
Someone can help me, please? :) :)
i'm trying to display my string with json but i'm seeing the tag <br/> instead of the line break:
what i expected:
" this is a
line break"
what i see:
"this is a<br/>line break"
on my document I've write
<
div
>${content}</
div
>
Someone can help me, please? :) :)
4 Answers, 1 is accepted
0
Nohinn
Top achievements
Rank 1
answered on 21 Sep 2012, 04:10 PM
Where are you trying to bind this json?
By any chance does your content reach the view encoded so it displays "<br/>" instead of the break-line?
We lack some info.
But as a first and general solution try this:
Depending on which control you're trying to bind this info it may have an "encoded" property you can set to false and it will render as it should.
By any chance does your content reach the view encoded so it displays "<br/>" instead of the break-line?
We lack some info.
But as a first and general solution try this:
<
div
>${content.replace(/<\s*\/?\s*br\s*.*?>/g, "\n")}</
div
>
Depending on which control you're trying to bind this info it may have an "encoded" property you can set to false and it will render as it should.
0
Marco
Top achievements
Rank 1
answered on 24 Sep 2012, 07:52 AM
Hi,
Here is the json:
Yeah, the content displays "<br/>" instead of the break-line, and I tried your general solution but it doesn't work... :(
Here is the json:
function
mobileSingleView(id) {
var
dataDb =
new
kendo.data.DataSource({
transport: {
read: {
contentType:
"application/json; charset=utf-8"
,
url:
"url?id="
+ id,
dataType:
"json"
,
type:
"POST"
,
error:
function
(xhr, status) {
console.log(status);
}
}
},
schema: {
// describe the result format
data:
function
(data) {
return
eval(data.project);
}
}
});
$(
"#temp"
).kendoMobileListView({
dataSource: dataDb,
pullToRefresh:
false
,
appendOnRefresh:
false
,
template: $(
"#template"
).html()
});
document.location.href =
'#scheda'
;
}
Yeah, the content displays "<br/>" instead of the break-line, and I tried your general solution but it doesn't work... :(
0
Marco
Top achievements
Rank 1
answered on 25 Sep 2012, 02:02 PM
No one helps me?
0
Marco
Top achievements
Rank 1
answered on 01 Oct 2012, 07:16 AM