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

Dynamic table shows " Delete all 232 records? " on sidebar #37

Closed
linonetwo opened this issue May 25, 2023 · 9 comments
Closed

Dynamic table shows " Delete all 232 records? " on sidebar #37

linonetwo opened this issue May 25, 2023 · 9 comments

Comments

@linonetwo
Copy link

linonetwo commented May 25, 2023

On my wiki https://wiki.onetwo.ren/#%E4%BE%A7%E8%BE%B9%E6%A0%8F%E6%83%B3%E6%B3%95%E5%88%97%E8%A1%A8:%E4%BE%A7%E8%BE%B9%E6%A0%8F%E6%83%B3%E6%B3%95%E5%88%97%E8%A1%A8%20Index

(This wiki is readonly, the source note is at https://github.com/linonetwo/wiki/blob/62232058e9659e32b1846fa340253af1be443318/tiddlers/%E4%BE%A7%E8%BE%B9%E6%A0%8F%E6%83%B3%E6%B3%95%E5%88%97%E8%A1%A8.tid#L12 )

截屏2023-05-25 20 20 58

This is strange.

(also, I was unable to sort it by Created field, using macro parameter, maybe same as #36 )

@kookma
Copy link
Owner

kookma commented May 26, 2023

The delete all only appears if you click on delete button on the header in Edit mode.

There is a temp tiddler $:/temp/tables/delete-all
delete it and see if still you have the warning red bar?

What happen when you click no on the warning bar? Is it persistent?

@linonetwo
Copy link
Author

linonetwo commented May 26, 2023

You can try it directly on my wiki ( on this, https://onetwo.ren/wiki/#%E4%BE%A7%E8%BE%B9%E6%A0%8F%E6%83%B3%E6%B3%95%E5%88%97%E8%A1%A8:%E4%BE%A7%E8%BE%B9%E6%A0%8F%E6%83%B3%E6%B3%95%E5%88%97%E8%A1%A8%20Index this site is single HTML ,so editable and not saved) ( https://wiki.onetwo.ren/#%E4%BE%A7%E8%BE%B9%E6%A0%8F%E6%83%B3%E6%B3%95%E5%88%97%E8%A1%A8:%E4%BE%A7%E8%BE%B9%E6%A0%8F%E6%83%B3%E6%B3%95%E5%88%97%E8%A1%A8%20Index is readonly)

On this sidebar tab

截屏2023-05-26 12 33 02

Clicking "no" have no effect
截屏2023-05-26 12 31 30

and $tw.wiki.getTiddler('$:/temp/tables/delete-all') don't exists.

This only happened on sidebar

@kookma
Copy link
Owner

kookma commented May 26, 2023

While I see the error on your wiki, but I cannot reproduce it on the demo page, as I use template for tabs. I believe this is a TiddlyWiki bad design of tabs where in that the currentTiddler does not work and you have to use template.

Dynamic table uses stateTiddler for intermediate data! when it is not passed explicitly in macro call, the currentTiddler is used and when dynamic tables are called from sidebar (e.g. tabs) the issue appears.

To solve your case do as below:

\define sv-exclude-tags() 想法

<$tiddler tiddler=<<currentTab>> >

<<table-dynamic filter:"[tag[想法]]" fields:"title created tags tbl-expand" pagination:yes class:"w-100 table-center" editButton:no emptyMessage:"太好了,所有想法都整理到笔记里">>

</$tiddler>

@kookma
Copy link
Owner

kookma commented May 26, 2023

Another solution is to use an explicit stateTiddler, like below:

<<table-dynamic filter:"[tag[想法]]" 
  fields:"title created tags tbl-expand" 
 pagination:yes class:"w-100 table-center" 
 editButton:no 
 emptyMessage:"太好了,所有想法都整理到笔记里"
stateTiddler:"Some State Tiddler Title Here" >>

@linonetwo
Copy link
Author

\define sv-exclude-tags() 想法

<$tiddler tiddler=<> >

<<table-dynamic filter:"[tag[想法]]" fields:"title created tags tbl-expand" pagination:yes class:"w-100 table-center" editButton:no emptyMessage:"太好了,所有想法都整理到笔记里">>

</$tiddler>

This works, thank you!

Just wrapping things that will show in sidebar, warp in <$tiddler tiddler=<<currentTab>> > </$tiddler>

@linonetwo
Copy link
Author

linonetwo commented May 27, 2023

But this does not work state:侧边栏想法列表/state , still shows error.

And it also not presist sort state. Which I hope can be achieved by #36

@kookma
Copy link
Owner

kookma commented May 28, 2023

Did you clearly set the stateTiddler on table-dynamic call?

@kookma
Copy link
Owner

kookma commented May 28, 2023

And it also not presist sort state. Which I hope can be achieved by #36

I think when you set a stateTiddler like mystate the Shiraz creates a tiddler like
$:/state/dynamictables/mystate/sortby and if you work on Node.JS this tiddler is not saved between sessions.

If you need to keep state, I have to do some changes in state handling in dynamic table.

For more info see https://kookma.github.io/TW-Shiraz/#%24%3A%2Fplugins%2Fkookma%2Fshiraz%2Fmacros%2Fdtables%2Fhelper to learn how Shiraz handles state and temp tiddlers for Dynmaic Table.

@linonetwo
Copy link
Author

I think I don't really need a persist state, just a default order is enough. This also prevent changes in the git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants