Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkbox within TH causes output from output widget to show "TRUE" or "FALSE" regardless of whether there is header text or not #1565

Closed
dmarra opened this issue Jul 3, 2018 · 4 comments

Comments

@dmarra
Copy link

dmarra commented Jul 3, 2018

I have a table which has a few columns that, in addition to header text, also have checkboxes which act as a "select all" feature. All of this works fine, until I export it using the output widget. The resulting CSV file is missing the text from the header, instead using the check state of the checkbox to determine what the column header should be.

Maybe I am doing something wrong, but this seems like a bug. I am using v2.30.4

@Mottie
Copy link
Owner

Mottie commented Jul 3, 2018

Hi @dmarra!

You can use the output_formatContent callback to determine what is sent to the output widget... in this case you can send the content when it's processing the header and the parsed data otherwise (demo):

$(function() {
  var $table = $("table");

  $(".download").click(function() {
    $table.trigger("outputTable");
  });

  $table.tablesorter({
    theme: "blue",
    widgets: ["zebra", "output"],
    widgetOptions: {
      output_formatContent: function(c, wo, data) {
        return data.isHeader ? data.content : data.parsed;
      }
    }
  });
});

@dmarra
Copy link
Author

dmarra commented Jul 5, 2018 via email

@Mottie
Copy link
Owner

Mottie commented Jul 5, 2018

Ah, the demo is using the "checkbox" parser in the parser-input-select file. Your custom parser may not be returning a human readable "checked" or "unchecked" value.

@Mottie
Copy link
Owner

Mottie commented Aug 27, 2018

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread.

@Mottie Mottie closed this as completed Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants