Allowing visitors to sort rows in data table

Hi,

Is there any way to allow visitors to sort the rows in a data table? e.g., sorting A>Z by name column, or largest to smallest in a numerical column.

Here’s my project: MP Second Job Scanner

Best,
Andrew

Unfortunately the Data Grid doesn’t support dynamic sorting at the moment (hopefully it will soonish).

For now, a somewhat clunky workaround would be to add multiple data grid components with each having a different sort setting, and then control the visibility of each via a choice component that writes to a User Specific Column. Just be aware that this approach can very quickly eat into your update quota, as each “click” would be counted as an update.

2 Likes

Hi Darren,

Thank you for the speedy response! :slight_smile:

I have a couple of other questions:

  • Can you extend the number of columns visible on a page? Right now it seems capped at 50 before it creates a new page.
  • Can you click through a row on a data grid which will take you to a new page (presented as a card preferably) which will show data from a different data source (i.e., another spreadsheet).

Best,
Andrew

Columns, or rows?
I’m not aware of any limits on either, but there might be. But 50 columns in a data grid seems excessive and would mean lots of horizontal scrolling, which doesn’t make for a very good user experience.

Unfortunately, no. The data grid component does not support item actions.

Personally, I’d be inclined to use either a List or Table collection, and just display a handful of attributes for each item. Then use the default item action to show a details screen for each item. If you have 50+ attributes for each item, what you could is construct a HTML table with two columns (attribute/value) and display in a Rich Text component on each items detail screen. I think this would be a better user experience as any scrolling would be vertical rather than horizontal.

1 Like

Apologies - I meant rows. It seems capped at 25 per page (see image) - and, ideally, I’d have all of the rows on one single page.

Thanks for your advice on the data grid. I’ll try that.

Best,
Andrew

You can adjust the page size under options.

Default is 24, but I think you can set it to whatever you like. Certainly 50 or 100 should be no problem at all.

2 Likes

Ah, missed that - thank you!

Hi @Darren_Murphy - If you don’t mind, I have a couple of other questions (I don’t want to spam the forum with noob questions :sweat_smile:).

  • Can you change the default column width? Some of my columns are wider than I want them to be, and some are narrower. They’re obviously adjustable for the user, but I’d like to be able to have some control how they appear by default.

  • Is there a way to add additional filters? On this page I’ve added a filter for political party, but I’d also like visitors to be able to filter the data grid by other fields (e.g., Region).

Much appreciated for your help so far.

Best,
Andrew

I’m afraid not. What you see is what you get. I think Glide does it’s best to auto-size the columns based on the data, but I agree it would be nice if you could set default column widths.

Not out of the box, but it’s possible to create your own custom filters. Here’s a tutorial that shows how to do that:

Bob’s tutorial uses a Glide App, but similar techniques can be applied to any list/collection in either Apps or Pages.

My earlier note about the impact on updates would also apply in this case:

2 Likes

Great, thanks again @Darren_Murphy .

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