2011-12-14 65 views
0

我在Dojo 1.6中遇到DataGrid问题。我在HtmlStore上创建了DataGrid,并且我想把最后一列的单元格放到一些行为中。我读过关于选项escapeHtmlInData =“false”的文档可以做到这一点,但它不起作用。我知道这是危险的(XSS攻击),但格式化程序的解决方案对我来说并不漂亮。所以我不知道为什么escapeHtmlinData不起作用。也许这是HtmlStore的错?也许有人有类似的问题?我可以粘贴我的代码段,但我使用Django和dojango。在Dojo中显示html中datagrid的单元格

+0

我解决我的问题。这是HtmlStore的错。我扩展了这个类,我重写了函数getValues() – citos88 2011-12-15 16:16:16

回答

1

对于其他人:

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是列名数组,其中是跑不了的数据

相关问题