OT: Let users filter table

I have a table, that get’s it’s data fro a local Json file.

The data is country, name, website etc.

Is there an easy way, to attach a filter on this, so i could let the users select all objects, from a specific country ?

The guides i have found, seam really complex, and involves a lot of JS.



From your somewhat terse description I gather that you display all table data first and then want the user to be able to drill down into it? Or do you want to provide them with an interface before you display the table and then select the data to display accordingly?

In any case, I doubt that you can do that without JavaScript. If you use Hugo, you users see static pages, so the only way to interact with them is JavaScript. If this is “a lot” depends on what you want to achieve.

That makes sense.

In my current setup, i present all data, to my users.
I don’t have a clear vision on the solution, but the form will be several 1000 lines, when i’m done, so i need some way of presenting it, in an more digestable way.
Being new to Hugo, i’m looking for guidance, on where to look, and what’s possible.



I doubt that this has anything to do with Hugo. As you said, your data is in a JSON structure. Since 1000 rows in a table is utterly unusable, you might want to collapse the data (like one row per country or whatever your topmost category is) before presenting it. Show an arrow to the right of the country’s name and use some JS code to expand this row when the user clicks on the arrow.
Something like that. There are JS table modules out in the wild, and one of them might do what you want.

Alternatively, you could rethink your design. Even preparing a 1000 row table without showing them all puts a tremendous burden on the browser. Which impedes usability.

That i really good feedback. Thanks.

In will put some more thoughts into it, and i might come back with more questions :slight_smile:


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.