My mistake was that I was adding the tablesaw classes and data-tablesaw-mode to a parent container, instead of the table. Check if you didn't do the same mistake first.
Then I trigger the ?enhance.tablesaw` event on the table (triggering it on document.body) didnt' work as well.
Just as I'm typing it... You do mean data-tablesaw-mode instead of data-mode right?
It works and collapses the columns but skips the label part... not sure why. I didn't got it working yesterday right away and stopped tinkering with it. Maybe it has to do something with my dynamic page, I'll check later if it works on a plain site with nothing else but tablesaw.
Yeah, 'data-tablesaw-mode' (updated my comment).
In your particular case, I think you'll have to replace
.data("tablesaw-mode", "stack")
with
.attr("data-tablesaw-mode", "stack");
Thanks mate. It worked, I'm not exactly sure why? I thought there is no difference between attr and data (except that jQuery tries to JSON.parse the data value on retrieval).
@posixpascal: filament-tablesaw/dist/stackonly/tablesaw.stackonly.js is the shoestring version, which does not alias data to DOM attributes. Switching to filament-tablesaw/dist/stackonly/tablesaw.stackonly.jquery.js would’ve probably worked too. If you are already including jQuery on your page, I’d recommend making that change anyway, it’ll save you a few KB.
I'm using the jquery plugin, with the accompanying css and js files, and when the window size is narrowed, the
Using latest js (tablesaw - v3.0.0-beta.4 - 2016-10-12)
I think you forgot to include the tablesaw-init.js :)
I am seeing this too, did you manage to sort it? (tablesaw - v3.0.0-beta.4, jquery plugin)
I'm having the same issues (tablesaw-init is included). Manually triggering enhance.tablesaw doesn't work either.
My mistake was that I was adding the tablesaw classes and data-tablesaw-mode to a parent container, instead of the table. Check if you didn't do the same mistake first.
I'm using jQuery to set the tablesaw classes like this:
Then I trigger the ?enhance.tablesaw` event on the table (triggering it on document.body) didnt' work as well.
Just as I'm typing it... You do mean data-tablesaw-mode instead of data-mode right?
It works and collapses the columns but skips the label part... not sure why. I didn't got it working yesterday right away and stopped tinkering with it. Maybe it has to do something with my dynamic page, I'll check later if it works on a plain site with nothing else but tablesaw.
Yeah, 'data-tablesaw-mode' (updated my comment). In your particular case, I think you'll have to replace
.data("tablesaw-mode", "stack")
with.attr("data-tablesaw-mode", "stack");
Thanks mate. It worked, I'm not exactly sure why? I thought there is no difference between attr and data (except that jQuery tries to JSON.parse the data value on retrieval).
So my current code looks like this:
My HTML:
That's it. :) Big thanks man.
Yes—thank you @adrianpuescu!
@posixpascal:
filament-tablesaw/dist/stackonly/tablesaw.stackonly.js
is the shoestring version, which does not aliasdata
to DOM attributes. Switching tofilament-tablesaw/dist/stackonly/tablesaw.stackonly.jquery.js
would’ve probably worked too. If you are already including jQuery on your page, I’d recommend making that change anyway, it’ll save you a few KB.@zachleat was there any solution generally speaking? @adrianpuescu of course I was including the JS.