mRender: return data variable as text (with html tags)
mRender: return data variable as text (with html tags)
JTavares
Posts: 3Questions: 0Answers: 0
Hi,
Does anyone know how can I return the data variable as text - containing html tags - with mRender?
[code]
"mRender": function (data, type, full) {
return data;
},
[/code]
Thanks,
Jose
Does anyone know how can I return the data variable as text - containing html tags - with mRender?
[code]
"mRender": function (data, type, full) {
return data;
},
[/code]
Thanks,
Jose
This discussion has been closed.
Replies
return ''+data+'';
[/code]
perhaps?
Allan
[code]
return '' + data + '';
[/code]
working with but 2 problems:
- terrible formatting
- using editable, the 'xmp' tags seems to be included on the input when user edit the cell
Another approach:
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
for(i=0; i!=aData.length; i++) {
if (i == 7) {
var dataht = oTable.fnGetData(nRow, 7);
$('td:eq(6)', nRow).closest('td').text(dataht);
}
}
},
[/code]
Problem:
.text(dataht) not retrieving html tags
any ideas?
Thanks
My point was that its just a string that mRender returns - you can have it return any HTML you want.
Allan
Hi
Solved so far:
2 things:
1) apply "fnRowCallback"
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
for(i=0; i!=aData.length; i++) {
if (i == 7) { // 0 is where loop start; so it's applied to 8th column - my first one isn't visible;
var dataht = oTable.fnGetData(nRow, 7); //get the data from each nRow, 8th column
$('td:eq(6)', nRow).closest('td').text(dataht); //'force' result as text
}
}
},
[/code]
optional - 2) change line 166 jquery.jeditable.js (Version 1.6.2)
[code]
//self.revert = $(self).html();
self.revert = $(self).text(); //when reverting HMTL tags, do it as Text
[/code]
Sorry if there are some mistakes but i only start web prog. 2 months ago; just sharing just in case. ☺
Thanks
Jose