basictable icon indicating copy to clipboard operation
basictable copied to clipboard

Add thead > td support

Open iamrobert opened this issue 2 years ago • 1 comments

Hi Jerry,

Great library.

With our CMS, it has a weird output for the tables as:

thead > tr > td

Do you think adding this line to your library would help make it more accessible?

      if (this.options.header) {
        let format = "";
        if (table.querySelectorAll("thead tr th").length) {
          format = "thead th";
        //Added Support
        } else if (table.querySelectorAll("thead tr td").length) {
           format = "thead td";
        } else if (table.querySelectorAll("tbody tr th").length) {
          format = "tbody tr th";
        } else if (table.querySelectorAll("th").length) {
          format = "tr:first th";
        } else {
          format = "tr:first td";
        }

Cheers,

Robert

iamrobert avatar Jul 22 '22 10:07 iamrobert

Hey @iamrobert the last condition should have taken care of this. What structure is your CMS outputting? Here's a sample I quickly mocked up: https://jsfiddle.net/owL2brd8/

jerrylow avatar Aug 02 '22 16:08 jerrylow