Item10972: Add ability to add new rows (topics) while editing as a grid
Priority: Enhancement
Current State: New
Released In: n/a
Target Release: n/a
MartinCleaver: I want to a way to add rows while editing existing rows
[10:27am] tsnfoo: So you want to add rows dynamically?
[10:28am] tsnfoo: That would be creating new topics, yeah?
[10:28am] MartinCleaver: yup, that's right
[10:29am] tsnfoo: Hmm. That would be nice
[10:29am] ModAcOst joined the chat room.
[10:30am] MartinCleaver: I can do it with some a <MyFormName>Creator topic, in my case DeliverableCreator - this is actually a redirect to %REDIRECT{"%SCRIPTURL{"edit"}%/%BASEWEB%/UnnamedDeliverableAUTOINC1?topicparent=DeliverableList;templatetopic=DeliverableTemplate;t=%SERVERTIME{"$day$hour$min$sec"}%" dontcheck="1"}%
[10:30am] MartinCleaver: but the issue with this is that it leaves the grid view
[10:31am] tsnfoo: I wonder if you could do the create via AJAX, then update the grid view yourself
[10:31am] MartinCleaver: or I guess I could bulk prepopulate a set of empty topics, and rename and fill them as I go along
[10:31am] tsnfoo: If not, we should definitely work this into a feature request.
[10:31am] tsnfoo: True.
[10:32am] tsnfoo: But I like the notion of REST handles for refreshing the MultiTopicSavePlugin grid
[10:33am] tsnfoo: So you could issue an AJAX call to create the topic, then tell the plugin to refresh the grid to keep it in sync
[10:33am] tsnfoo: I guess you could just manipulate the markup yourself
[10:34am] MartinCleaver: y, as long as the locks are handled properly, manipulating the markup might be better?
[10:34am] tsnfoo: It sounds kinda ghetto, but I think you're right.
[10:35am] tsnfoo: Click a button to add a row, use an AJAX call to setup the new topic, adding a callback to update the grid view's markup on success or failure.
[10:35am] tsnfoo: The next time the topic is submitted, you should be back in sync.
[10:36am] tsnfoo: That might totally work for one of my project's too...
[10:36am] MartinCleaver: how would you make sure the topic gets back in sync?
[10:36am] tsnfoo: Arg. Unnecessary apostrophe.
[10:36am] MartinCleaver:
[10:37am] tsnfoo: Well, I guess it would happen when you click the save button on your MultiTopicSavePlugin-enabled topic.
[10:37am] MartinCleaver: hmm. Should do. But, I'm not sure how it works.
[10:37am] tsnfoo: The next it loads, it would now find any AJAX-created topics that hadn't been there last time.
[10:38am] tsnfoo: I have no idea if it would work yet; I'll try it later today.
--
MartinCleaver - 15 Jul 2011
From
http://sourceforge.net/mailarchive/forum.php?thread_name=1311508650.9537.YahooMailNeo%40web39302.mail.mud.yahoo.com&forum_name=foswiki-discuss
Not knowing the details of jqgrid, I think alot can be done client side using the (rest) interface to
MultiTopicSavePlugin and bin/save. The icing on the cake I am missing from time to time in this conjunction is a bin/save auto-inc which reports back the created topic name.
--
OliverKrueger
I'm supposing a non-jqgrid version would work like this. The grid shown would include a button to "make new row". That would alter the Document Object Model to add the form fields to the webpage with the grid on it. The row being created would need to trigger the creating of the corresponding topic.
Oliver it looks like you wanting a way for save to tell you the name of the page that
save just created? Else REST POST to /bin/save/WEBNAME/FORMNAMEAUTOINC1 is useless?. If so, how about - for the case in hand - a field to specify the page name?
In fact, if the name of the page to be created is specified by the user, and embedded in the webpage form, wouldn't adding rows to the DOM with the right name suffice? Or does the MULTITOPICSAVE plugin check that it had a lock on all the pages in the form before trying to edit them? If the page names didn't exist it could just try to create them.
--
MartinCleaver - 24 Jul 2011
If you do not need the AUTOINC feature, you can of course make up any unique topic name in your client and create topics with that name via bin/save. Something like prefix plus md5(username+timestamp).
--
OliverKrueger - 24 Jul 2011