The title doesn’t convey the complexity of the question appropriately. But I was not sure how to frame the title.
So I have this need in my dynamic table.
I have fields like field-1
, field-2
, field-3
and so on with certain field-values like fieldvalue-1
, fieldvalue-2
, fieldvalue-3
and so on.
Again I store these field-values in a list like field called tbl-fields-value
as fieldvalue-1 fieldvalue-2 fieldvalue-3
I can edit the field-values of the fields like field-1
, field-2
, field-3
using edit-text widget. Whenever a field-value change, for example say fieldvalue-1
of the field-1
change, I want that value to change in the list field called tbl-fields-value
also. Is that possible ?
This image show how I am editing the fields like field-1
. Its based on a similar solution provided by @EricShulman in an old post of mine. On pressing the edit text widget, a pop up opens using reveal widget which shows a list of values as button widgets. Actions parameter of these button widgets can be used to edit the value of the list like field called tbl-fields-value
I tried search replace operator, but the result was not accurate. So can someone help to solve this.
This was my attempt
\function loading-tbl-field-name()
[<currentTiddler>get<tbl-field-select>]
\end loading-tbl-field-name
\function tbl-field-names()
[enlist<select-field>search:title<loading-tbl-field-name>format:titlelist[]join[ ]]
\end tbl-field-names
\function tbl-field-name-popid()
[[$:/state/tbl-field-name-pop/]addsuffix{!!title}addsuffix[/]addsuffix<tbl-field-select>]
\end tbl-field-name-popid
\procedure tbl-field-name-pop-action()
<$action-setfield $tiddler=<<currentTiddler>> $field=<<tbl-field-select>> $value=<<tbl-field-name>> />
<$list filter="[<currentTiddler>fields[]prefix[field-]]" variable="tbl-field-select">
<$let tbl-field-select-value={{{ [<currentTiddler>get<tbl-field-select>] }}}
>
<$action-setfield $tiddler=<<currentTiddler>> $field="tbl-fields-value" $value={{{ [{!!tbl-fields-value}search-replace<tbl-field-select-value>,<tbl-field-name>] }}} />
</$let>
</$list>
\end tbl-field-name-pop-action
<$let
tbl-field-selector={{!!tbl-field-selector-value}}
select-field={{{ [<tbl-field-selector>get[list]sort[]] }}}
tbl-filter={{{ [<currentTiddler>get[tbl-filter-value]] ~[<tbl_filter>] }}}
tbl-fields={{{ [<currentTiddler>get[tbl-fields-value]] ~[<tbl_fields>] }}}
>
<$list filter="[<currentTiddler>fields[]prefix[field-]]" variable="tbl-field-select"><$edit-text tiddler=<<currentTiddler>> field=<<tbl-field-select>> tag="input" class="column-selector tc-popup-handle tc-max-width" focusPopup=<<tbl-field-name-popid>>/>
<$reveal type="popup" state=<<tbl-field-name-popid>> class="tc-drop-down" position="below" animate="yes" retain="yes" style="min-width:auto;">
<$list filter=<<tbl-field-names>> variable="tbl-field-name">
<$button class="tc-btn-invisible" actions=<<tbl-field-name-pop-action>> >
<div style="overflow:₹;text-overflow:ellipsis;">
<$text text=<<tbl-field-name>>/>
</div>
</$button>
</$list>
</$reveal>
</$list>
</$let>