在tr中添加加号减去图标

时间:2017-02-24 07:55:33

标签: javascript

我想在tr中添加一个+, - 图标。下面是代码,我用它来扩展和折叠表tr / td。

xcodebuild test -workspace App.xcworkspace -scheme App -destination 'platform=iOS Simulator,name=iPhone 6, OS=10.2'

我添加了以下代码以及相应的css

//添加事件监听器以打开和关闭详细信息

// Click handler to show / hide the details rows when they are available

$(dt.table().body())
    .on('click.dtr mousedown.dtr mouseup.dtr', selector, function(e) {
        // If the table is not collapsed (i.e. there is no hidden columns)
        // then take no action
        if (!$(dt.table().node()).hasClass('collapsed')) {
            return;
        }
        // Check that the row is actually a DataTable's controlled node
        if ($.inArray($(this).closest('tr').get(0), dt.rows().nodes().toArray()) === -1) {
            return;
        }
        // For column index, we determine if we should act or not in the
        // handler - otherwise it is already okay
        if (typeof target === 'number') {
            var targetIdx = target < 0 ?
                dt.columns().eq(0).length + target :
                target;
            if (dt.cell(this).index().column !== targetIdx) {
                return;
            }
        }
        // $().closest() includes itself in its check
        var row = dt.row($(this).closest('tr'));
        // Check event type to do an action
        if (e.type === 'click') {
            // The renderer is given as a function so the caller can execute it
            // only when they need (i.e. if hiding there is no point is running
            // the renderer)
            that._detailsDisplay(row, false);
        } else if (e.type === 'mousedown') {
            // For mouse users, prevent the focus ring from showing
            $(this).css('outline', 'none');
        } else if (e.type === 'mouseup') {
            // And then re-allow at the end of the click
            $(this).blur().css('outline', '');
        }
    });

但是我无法显示结果。

0 个答案:

没有答案