Shiraz dynamic table problem with sort

I use TiddlyWiki Node.js edition v.5.4.0. I have a dynamic table as follows:

<<table-dynamic
filter:“[tag[HOA]sort[sort-key]]”
fields:“tbl-expand title description sort-key tags”
linkFields:“title”
stateTiddler:“dashboard-hoa-table”
class:“table-striped table-hover table.sm email-table”
caption:“‘‘🔰 HOA’’”>>

I cannot get the sort by the field sort-key to work. That field is populated with 010, 020, 030 etc.

If I try
{{{ [tag[HOA]sort[sort-key]get[title]] }}}
I can see the tiddlers sorted properly. Hence maybe the Shiraz plugin has a problem in my case.

Shiraz’s dynamic table sorting is itself dynamic, based on column headers rather than any sorting operators used in the filter. Try clicking on the “sort-key” header in your table; it should automatically sort (or reverse sort) the table based on values in that column.

Here’s an example from the Shiraz documentation that I just sorted by the email field:

Hello,
I think the problem is the double quotes used in the filter. Try these examples.

Sort by sort-key value.json (361 Bytes)

sort-key example tiddler.json (109 Bytes)

sort-key example tiddler 2.json (111 Bytes)

I know about that solution, but I was looking for something that would sort by the sort-key column by default instead of clicking on the column heading. Also there may be a case when I don’t want that column to be visible.

I tried it but the result is still alphabetical by title. Your examples also use double quotes and I don’t understand exactly what is the mistake..

Hello @wikster

I mention quotes as I think I read somewhere that Smart Quotes produced by some apps had an adverse affect on some tiddlywiki code.

I produced the quotes on the keyboard (shift+2)

Drag the attached json file on to shiraz they seem to sort automatically and also by clicking the column title

Thank you for the reply. The test on the Shiraz website works, but unfortunately it does not work for me in my wiki as regards sorting by sort-key by default.

I could be totally wrong, but I think that Shiraz tables are sorted alphabetically by tiddler title by default, but one can click on the headers to change the sorting of any column.

The link I provided to the Shiraz site was for an old version 2.9.7
Shiraz was updated by @Mohammad a while back and there were some differences.
What version of shiraz are you using? Maybe that is the reason for the problem.

Regarding the smart quotes, search this forum for “smart quotes” for other solutions/problems.

I’m using v.2.9.7. It’s the most recent that I could find.

Maybe the new version has not been released yet.

Are you working on phone, tablet, laptop ?

I’m running TW in Node.js on a desktop PC (Tuxedo OS).

I am at a loss here, some software uses smart quotes, not sure Tuxedo OS does,

Maybe you could check your software settings?
Sorry I can’t offer another solution.

Check this link by @etardiff re quotes

The latest is 3.0.0 from July 2025. I don’t think it’s “officially” released yet, but you can find it here:

From the above, the actual plugins are here (stating their version as 3.0.10):

@Mohammad had started working on Shiraz 3.0 a couple of years ago (see the GitHub branch and the discussion thread here) but as he lives in Iran, I’m not sure when he’ll be able to return to it.

In Shiraz 2.9.7, dynamic table sorting-by-column is ultimately hardcoded into the macro (and IIRC this was not intended to change in 3.x). Here’s the relevant bit of code:

\define tableFilter_fields()   $(inputFilter)$+[$(sortneg)$$(sortType)${$(tempTableSort)$##sortIndex}]
  • $(inputFilter)$ refers to the filter:"..." you used in your macrocall.
  • It’s followed by a second filter run, +[$(sortneg)$$(sortType)${$(tempTableSort)$##sortIndex}], where…
    • $(sortneg)$ handles “reverse” sorting if you click on one of the header buttons
    • $(sortType)$ is based on the (optional) sortOp parameter supplied in the table-dynamic macrocall: “the sort operator used to sort column like sort, sortcs, nsort, nsortcs, sortan … The default value is sort.”
    • {$(tempTableSort)$##sortIndex} retrieves the name of the field used for sorting; it’s set in a temporary tiddler if/when you click on a column header.
  • If you don’t click on an a column header, this entire filter run will default to +[sort[]], i.e. “sort by title”.
  • Since this filter run always follows the filter you supply in the macrocall (and thus overrides any alternate sort you specify), the table will always be sorted by tiddler title unless you click on a header.

Unfortunately there’s no simple way to modify this behavior, as the dynamic table macro is very complex. If you need this sort of control over the sorting, it’s probably not a good solution for you.

Thank you for trying. I’m using straight quotes and my quotes work everywhere in my wiki anyway. The problem must be due to something else.

Thanks @Lamnatos for the links to new version.

Thank you @etardiff for the detailed explanation.

@Lamnatos and @etardiff thank you for the information. It puts my mind at ease. I’ll happily continue using v.2.9.7 now that I know its capabilities and limitations.