简体   繁体   中英

how can i change footable header style?

I'm using footable on a project. When footable generates responsive table it makes th and td s within the same tr. But i want it to seperate th and 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.

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:

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()
        }
    }
})     

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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