tablemaker icon indicating copy to clipboard operation
tablemaker copied to clipboard

Check for empty table

Open imagehat opened this issue 10 years ago • 3 comments

This plugin is absolutely great, thank you for sharing it!

One suggestion I have is to add a way to check if the table is actually used. Right now the default state of the columns and rows are such that empty data is saved with the entry even if nothing is entered so there is no good way (that I can tell) to check for the field in a template conditional.

Even if you delete the columns and rows the next time the publish form is loaded it defaults back to one empty row for each and would be saved again that way.

Again, this is a great plugin! Perhaps I'm just missing something obvious being fairly new to Craft/Twig.

imagehat avatar May 13 '15 17:05 imagehat

Aha, well I had not thought to check that, which is a bit of a big oversight!

Thanks for updating me - I will try and take a look soon, but if you can and fancy it feel free to submit a PR :)

joshangell avatar May 13 '15 18:05 joshangell

I got around it for now with this (super ugly) template check to see if the first row is empty {% if entry.demographics.rows[0][0] is defined and entry.demographics.rows[0][0]|length %}.

If I dig deeper I'll definitely submit a PR. Thank you!

imagehat avatar May 13 '15 18:05 imagehat

Has this enhancement ever been worked on?

I now have the same issue and using the above workaround...

seandelaney avatar Nov 18 '16 11:11 seandelaney