首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Wijgrid销毁数据-属性

Wijgrid销毁数据-属性
EN

Stack Overflow用户
提问于 2012-01-04 08:15:11
回答 1查看 518关注 0票数 1

我将一些数据属性放入表行标记中。当我将表格设置为wijgrid时,数据属性会被销毁。

如何防止wijmo破坏这些属性?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-01-05 18:20:24

当在行上应用属性(tr)时,它们会被插件忽略(正如你所经历的),不管它们是什么(样式、类、数据...)。

这似乎是自愿的,因为在插件源代码中注释了,这段代码通常会提取行的属性。

在方法readTableSection中,我们有(我在这里删除了不相关的代码行):

代码语言:javascript
复制
readTableSection: function(table, section, readAttributes) {

    ...

    if (table && (section = this.getTableSection(table, section))) {

        for (ri = 0, rowLen = section.rows.length; ri < rowLen; ri++) {

            row = section.rows[ri];
            tmp = [];

            if (readAttributes) {

                // here normally the html attributes of the rows (<tr>) should be extracted
                // but the code is commented !
                tmp.rowAttributes = null; // $.wijmo.wijgrid.getAttributes(row);
                tmp.cellsAttributes = [];

            }

            // here is extracted the html attributes for the cells (<td>)
            for (ci = 0, celLen = row.cells.length; ci < celLen; ci++) {
                tmp[ci] = row.cells[ci].innerHTML;
                if (readAttributes) {
                    tmp.cellsAttributes[ci] = $.wijmo.wijgrid.getAttributes(row.cells[ci], prevent);
                }
            }

            result[ri] = tmp;
        }
    }

    return result;
}

我对td元素的"data-“属性进行了测试,它们没有被销毁。

注意:您必须使用选项readAttributesFromData

你可以联系开发这个插件的公司,询问他们为什么要注释掉这一行。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8720528

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档