Django 在Dojo中的datagrid单元格中显示html
我发现Dojo1.6中的DataGrid有问题。我在HtmlStore上创建了DataGrid,我想在最后一列的单元格中加入一些操作的链接。我在文档中看到,escapeHtmlInData=“false”选项可以做到这一点,但它不起作用。我知道这很危险(XSS攻击),但格式化程序的解决方案对我来说并不合适。所以我不知道为什么escapeHtmlinData不起作用。也许是HtmlStore的错?也许有人也有类似的问题?我可以粘贴我的代码,但我使用Django和dojango。其他代码:Django 在Dojo中的datagrid单元格中显示html,django,datagrid,hyperlink,dojo,cell,Django,Datagrid,Hyperlink,Dojo,Cell,我发现Dojo1.6中的DataGrid有问题。我在HtmlStore上创建了DataGrid,我想在最后一列的单元格中加入一些操作的链接。我在文档中看到,escapeHtmlInData=“false”选项可以做到这一点,但它不起作用。我知道这很危险(XSS攻击),但格式化程序的解决方案对我来说并不合适。所以我不知道为什么escapeHtmlinData不起作用。也许是HtmlStore的错?也许有人也有类似的问题?我可以粘贴我的代码,但我使用Django和dojango。其他代码: dojo
dojo.extend(dojox.data.HtmlStore,{
getValues: function(item,attribute){
this._assertIsItem(item);
var index = this._assertIsAttribute(attribute);
if(index>-1){
var text;
if(item.cells){
if({%for value in noEscapeData%}attribute=="{{value}}"{%if not forloop.last %} || {%endif%}{%endfor%}){
text = item.cells[index].innerHTML;
}else{
text = dojox.xml.parser.textContent(item.cells[index]);
}
}else{//return Value for lists
text = dojox.xml.parser.textContent(item);
}
return [this.trimWhitespace?dojo.trim(text):text];
}
return []; //Array
},
});
其中
noEscapeData
是列名为的数组,其中不是转义数据我解决了我的问题。这是HtmlStore的过错。我扩展了这个类,并重写了函数getValues()