简体   繁体   English

我如何更改可设置页眉样式?

[英]how can i change footable header style?

I'm using footable on a project. 我在项目上使用了footable。 When footable generates responsive table it makes th and td s within the same tr. 当footable生成响应表时,它将th和td置于同一tr内。 But i want it to seperate th and tds. 但是我想让它与TDS分开。 Let me try to explain with pictures. 让我尝试用图片解释。 I want it like that. 我想要那样

在此处输入图片说明

But it generates like that: 但它生成的是这样的:

在此处输入图片说明

Basicly i'd like to seperate th and tds with different tr tags. 基本上,我想用不同的tr标签分隔th和tds。

Is that even possible? 那有可能吗? Thank you. 谢谢。

Definitely possible and a lot of ways to do it. 绝对有可能,并且有很多方法可以做到这一点。 I'd say quickest way is to bind to the "expand.ft.row" event: 我想说的最快的方法是绑定到“ expand.ft.row”事件:

FooTable.init("#element", {
    on: {
        "expand.ft.row": function (e, ft, row) {
            window.setTimeout(function() {
                var detailTRs = row.$el.find(".footable-details > tbody > tr").not(".processed")
                detailTRs.before(function() {
                    return $("<tr>").append($(this).children("th"))
                }).addClass("processed")
            }, 1000);
        },
        "collapse.ft.row": function (e, ft, row) {
            //remove the leftover tr elements we created.
            row.$el.find(".footable-details > tbody > tr").remove()
        }
    }
})     

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM