【问题标题】:Dojo's onBeforeRow not being calledDojo 的 onBeforeRow 未被调用
【发布时间】:2013-12-27 01:44:23
【问题描述】:

我正在尝试在 Dojo Toolkit 中做一个解决方法,您不能通过在其中添加一个只有宽度的虚拟行来在第一行上执行 colspan。创建行后,将使用 onBeforeRow 隐藏行。

请参考以下内容。

  1. Dojo Bug Report

  2. Dojo-Grid-Header-Column-Grouping

这是我的代码:

ConfirmGridGrid = new DataGrid({
    store: ConfirmGridDataStore,
    structure: [
        [
             { width: '35px'} 
            ,{ width: '35px'} 
            ,{ width: '60px'} 
            ,{ width: '60px'} 
            ,{ width: '60px'} 
            ,{ width: '60px'} 
            ,{ width: '25px'} 
            ,{ width: '25px'} 
            ,{ width: '40px'} 
            ,{ width: '25px'} 
            ,{ width: '25px'} 
            ,{ width: '25px'} 
            ,{ width: '240px'} 
            ,{ width: '25px'} 
        ],[
             { name: 'Product Code', field: 'ProductCD', width: '70px', colSpan: 2, editable: false} 
            ,{ name: 'Product Name', field: 'ProductNM', width: '240px', colSpan: 4, editable: false} 
            // The rest of second column..............................
        ],[
            // Third column..............................
        ]
    ],
    onBeforeRow: function(inDataIndex, inSubRows){
        inSubRows[0].invisible = true;
    }
}, "ConfirmGrid");
ConfirmGridGrid.startup();

由于某种原因,onBeforeRow 事件没有被调用。有什么需要补充的吗?还是您需要进行其他事件接线才能使其正常工作? 顺便说一下,我使用的是 Dojo 1.9.1。

【问题讨论】:

    标签: dojo dojox.grid.datagrid dojox.grid


    【解决方案1】:

    我最终发现了为什么它没有被调用。我放错地方了。

    我应该把它作为结构值的属性而不是网格定义。

    希望这对以后的其他人有所帮助。

    structure: [
        [
             { width: '35px'} 
            ,{ width: '35px'} 
            ,{ width: '60px'} 
            ,{ width: '60px'} 
            ,{ width: '60px'} 
            ,{ width: '60px'} 
            ,{ width: '25px'} 
            ,{ width: '25px'} 
            ,{ width: '40px'} 
            ,{ width: '25px'} 
            ,{ width: '25px'} 
            ,{ width: '25px'} 
            ,{ width: '240px'} 
            ,{ width: '25px'} 
        ],[
             { name: 'Product Code', field: 'ProductCD', width: '70px', colSpan: 2, editable: false} 
            ,{ name: 'Product Name', field: 'ProductNM', width: '240px', colSpan: 4, editable: false} 
            // The rest of second column..............................
        ],[
            // Third column..............................
        ],
        ,onBeforeRow: function(inDataIndex, inSubRows){
            inSubRows[0].invisible = true;
        }
    ],
    

    在我的情况下,将其设置为不可见是不够的。您需要更改 css 以删除填充和边框。

    tr.dojoxGridInvisible th
    {
        padding: 0px !important;
        border: 0px !important;
    }
    
    tr.dojoxGridInvisible td
    {
        padding: 0px !important;
        border: 0px !important;
    }
    

    引导我找到答案的示例代码是这个邮件列表。 here

    【讨论】:

    • 如何以编程方式覆盖 css 设置?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-07
    • 2016-05-21
    相关资源
    最近更新 更多