This is a Shortcut for helping people display large amounts of data. It doesn’t do anything practical, its a starting point for creating your own easy to use on mobile tables.
It uses DataTables to show tables in a way that works better for mobile, with pagination, search, responsive tables, and will bunch data with expand/collapse to make it easier to work with on mobiles.
It contains a sample table, which you should fill the text action with your table, or the output of your Shortcut in table format. You could use this Shortcut as a starting point for eg a CSV to tables Shortcut, or to pick up saved CSV in your iCloud Drive you need to view etc.
For a more advanced user, you could also insert the data as javascript data rather than go through the extra step of generating tables. That isn’t covered here more information : https://datatables.net/manual/data/
I’d love to hear if anyone uses it in a project.
Automatically reforms to Landscape or Portrait. With hidden details available in portrait via expand/collapse buttons
This looks seriously awesome, may replace Filemaker Go for me for some applications. FM makes it very expensive to sync as a single user, so I’ve been using my databases read only on iOS anyway.
The example here just converts a html table of data.
You’ll probably want to look at the JavaScript var method as it’ll be easier than trying to convert any data to a table first.
Someone on Reddit mentioned they used this https://github.com/derekeder/csv-to-html-table as well which apparently makes easier to send csv to DataTables but I have no personal experience of it so cant say if its any good myself.
Here’s a quickly hacked together shortcut that uses viticci@macstories.net Spreadsheet to Markdown which takes a Clipboard Copy of spreadsheet data converts it to Markdown table, then html then adds it into the boilerplate.
Well I ended up adapting my parser but it’s way too slow - I think I’d need to do the conversion to html in advance and cache it or keep the file on a server somewhere and let it handle the conversion. Talking 12-25 seconds for a table with 80 rows and maybe 100 columns.
Here’s the parser - it expects a CSV file as input.
It’s quite possible I will update it to deal with csv directly, I just don’t want to commit to saying I will as I have more urgent demands on my time right now.
Honestly unless you’re going to build it in another language and integrate it, I wouldn’t invest the time, Shortcuts is natively too slow to do long iterations.
I think it will be most useful for saving the results as bookmarks, where you run the Shortcut once to create the page. I’d also be more interested in seeing tweaks to the UI to add buttons e.g. to copy a result etc.
Javascript variable/arrays are something like var = { “sdfsf”,“sfsdfa”,“sdfs” } so appears easy to reformat and insert, might be a few gotchas around escaped characters and obscure csv formats but not too hard.
@entee thanks for sharing! Very useful. I’ve converted a few of my “display info” type Shortcuts to use a DataTable view. Far more flexible and visually appealing than a QuickLook or Show Results.
This is clearly parsing csv much faster than the approach I had taken - looks like you are using replace in the text rather than parsing out each delimited item - nice.
@entee again… really enjoying having this capability. I’ve been exploring the DataTable API (first time I’ve used it). I would like to enable the horizontal scroll using the scrollX attribute.
This attribute doesn’t seem to change the behavior. If I set to true, the columns displayed doesn’t change. I still have the expand/contract button to see the overflow columns. I would like to simply have all columns scrollable.
Thoughts on why the scrollX attribute may not be working?
Other parameter changes are working (eg, paging: false)
Seems to work ok when I enable it, it only shows 2 columns on my phone landscacpe when enabled. Could you share the $('#example').dataTable( { bit with all the options you have. enabled.