问题描述
我正在使用jQuery Datatables版本1.10.7,并且我想使用呈现功能来防止XSS攻击:
I'm using jQuery Datatables version 1.10.7 and I want to use the rendering function to prevent XSS attacks:
"processing" : true,
"bJQueryUI" : true,
"order" : [ [ 0, "asc" ] ],
"columnDefs": [
{
"targets": '_all',
"render": $.fn.DataTable.render.text()
}
],
"aoColumns" : [
{
"mData" : "name",
"defaultContent" : " "
},
问题是我遇到以下错误:
The problem is that I'm getting the following error:
预先感谢您的帮助.
推荐答案
您在这里遇到两个问题.首先请注意,它应该是$.fn.dataTables
,而不是$.fn.DataTables
.请注意小写的d
.
You have two issues here. Firstly note that it should be $.fn.dataTables
, not $.fn.DataTables
. Note the lowercase d
.
要感谢的最后一件事是@davidkonrad,render.text()
仅在1.10.10版本中可用,因此要使此功能正常运行,您还需要更新DataTables的版本.
One final thing to note, thanks to @davidkonrad, is that render.text()
is only available from version 1.10.10, so for this to work you will also need to update your version of DataTables.
"processing": true,
"bJQueryUI": true,
"order": [[ 0, "asc" ]],
"columnDefs": [{
"targets": '_all',
"render": $.fn.dataTable.render.text()
}
}],
这篇关于$ .fn.DataTable.render.text不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!