Question
I am using the EditTableRow plugin to have an editable table that can scale to many hundreds of rows.
How can I include a twiki variable in the web form template (e.g., in the 'values' column) so that it gets expanded whenever I create a new row to produce a default value that can be different each time?
More detail: One of the fields of my table is an ID that I would like to have autogenerated. I've written a simple plugin %NEXT_ID{topic=... prefix=...}% that will search through a topic for any id's (strings that start with a prefix followed by digits) and returns the next highest unique ID. E.g., if I have:
And then I add a new row to this table via the EditTableRow plugin, I want the ID column to automatically have a new id of ID0003.
In the web form template (as referenced by the EditTableRow plugin's "template" parameter), I create a 'label' type entry where the value is set to %NEXT_ID{topic="Sandbox.MyTopic" prefix="PR"}%. Then when I click on the edit box of my table and add a new row, the table gets updated by adding a new row where the ID field is set to: %NEXT_ID{topic=Sandbox.MyTopic prefix=PR}%. Two things about this:
- Note that the quotes have disappeared, making this something that extractNameValuePair() will croak on.
- I want to have this expanded out to be the actual ID that %NEXT_ID% returns, not the TWiki variable itself. I.e., if I add another column, then it will have the same ID as the previous one.
So, I'm looking to solve either:
- How do I get my %NEXT_ID% plugin to resolve to its actual value when I add a new row to my EditTableRow table?
- Is there a better way to have a unique monotonically increasing ID created automatically for a field using the EditTableRow plugin?
Thanks in advance for any help!
Cheers,
Martin.
Environment
--
MartinReddy - 31 Jan 2006
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Martin, take a look at
ChangeRequest that was created by (I believe) Peter. Although there are corner cases that may cause you to tweak this app I believe the solution is simple and make use of pre-existing plugins. I kicked myself when Peter pointed me toward the sandbox as there are
many examples in here that can be applied to many different scenarios.
Have Fun!
--
SteveRJones - 01 Feb 2006
Nothing back so I am closing this as answered.
--
SteveRJones - 28 Feb 2006