adding second action along with primary button action

47 views
Skip to first unread message

Dave

unread,
Dec 12, 2019, 9:23:44 PM12/12/19
to TiddlyWiki
I have this code that displays a button and a list

<$button>
load recent changes
<$action-listops $tiddler=<
<thisTiddler>> $field="list" $filter="[tag[today]!tag[exclude]!tag[done]sort[priority]]"/>
</$button>


<<list-links-draggable tiddler:"Today List" itemTemplate:"draggableTemplate1">>


The list items are sortable, and when you click the button, it re-populates the list from that filter.


the draggable template looks like this:
{{||add main tags2}} <$link to={{!!title}}>{{!!title}}</$link>



which ultimately (through a couple transclusions) refers to this:
<span style=background-color:red; class="tc-tag-label">
  <$button message="tm-delete-tiddler" tooltip="delete" class="tc-btn-invisible">
    delete
  </$button>
</span>


That's a delete button that successfully deletes the tiddler in question

What I want to do is have this function from the first button
<$action-listops $tiddler=<<thisTiddler>> $field="list" $filter="[tag[today]!tag[exclude]!tag[done]sort[priority]]"/>


to also run when I click the red "delete" button, but when I paste that in that delete button code (e.g. just after the word "delete") it doesn't work.


Is there some little thing I'm doing wrong here?  I've tried changing the $tiddler=<<thisTiddler>> part to $tiddler="Today List" which is the tiddler with that list in it, but that didn't work either.


Any suggestions?

TonyM

unread,
Dec 12, 2019, 9:49:11 PM12/12/19
to TiddlyWiki
Dave,

I am not exactly sure what you are trying to achieve but have you tried is before the delete "label"?

However more likely it may be that the message in the button is executed after the actions inside the button. Perhaps drop the message and use the action send message widget tm-delete-tiddler inside the button before the listops action, or define both actions in a macro and use the action parameter on the button
\define delete-refresh-actions()
<$action-sendmessage $message="tm-modal" $param="<<currentTiddler>>/>
<$action-listops $tiddler=<<thisTiddler>> $field="
list" $filter="[tag[today]!tag[exclude]!tag[done]sort[priority]]"/>
\end

<$button actions=<<delete-refresh-actions>> tooltip="
delete" class="tc-btn-invisible">
delete
</$button>
Although in the above I am not sure how to set the tiddler name to be deleted see $param in delete-refresh-actions

Let me know if you have any sucess
Tony

Dave

unread,
Dec 13, 2019, 12:14:34 AM12/13/19
to TiddlyWiki
Thanks Tony, I'll give that a try in the next couple days and let you know how it goes

Dave

unread,
Dec 13, 2019, 12:46:04 AM12/13/19
to TiddlyWiki
Here's what I got working:
\define myactions()
<span style=background-color:red; class="tc-tag-label">
<$action-sendmessage $message="tm-delete-tiddler" tooltip="delete" class="tc-btn-invisible"/>
<$action-listops $tiddler="Today List" $field="list" $filter="[tag[today]!tag[exclude]!tag[done]sort[priority]]"/>
</span>
\end
\define justDelete()
<$button actions=<<myactions>>>{{$:/core/images/erase}}
</$button>
\end
<<justDelete>>


Your comments reset my tiddly-thinking, and that led to this other thread that also helped:

I appreciate your diligent help here :)

TonyM

unread,
Dec 13, 2019, 4:54:52 AM12/13/19
to TiddlyWiki
Great to hear dave
Reply all
Reply to author
Forward
0 new messages