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

Check for empty table #1

Open
imagehat opened this issue May 13, 2015 · 3 comments
Open

Check for empty table #1

imagehat opened this issue May 13, 2015 · 3 comments
Assignees

Comments

@imagehat
Copy link

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.

@joshangell
Copy link

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 :)

@imagehat
Copy link
Author

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!

@joshangell joshangell self-assigned this Jul 23, 2015
@seandelaney
Copy link

Has this enhancement ever been worked on?

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

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

4 participants