Question
One of the Wish List items for
Plugins.EditTablePlugin is to be able to specify putting the "Edit" button at the top.
One of my users just requested this today.
Has anyone come up with a workaround, probably in HTML forms and/or
JavaScript, to implement this?
Environment
--
VickiBrown - 26 Feb 2008
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.
This is a script that uses
BehaviourContrib (installed by default). It assumes you know the name of the form (
edittable1).
<script type="text/javascript">
var rules = {
'.editTableEditImageButton' : function(el) {
var clone = el.cloneNode(false);
var ettablenrEl = document.forms.edittable1.ettablenr;
ettablenrEl.parentNode.insertBefore(clone, ettablenrEl);
clone.style.marginBottom = '2px';
el.parentNode.removeChild(el);
}
};
Behaviour.register(rules);
</script>
--
ArthurClemens - 26 Feb 2008
That works great (when we have one table). Of course, if we have two tables, it puts two buttons at the top of edittable1.
I thought I'd re-open this while I flail around on the code... perhaps someone with more
JavaScript experience will te pity on me and help me to extend this script to handle more than one table on a page.
--
VickiBrown - 13 Oct 2008
This can be a workaround with no need for javascript. But for some causes I can not figure out in this TWiki installation the edition in one table modifies de button on the other. On my local intranet it works well with TWiki-4.2.0.
%EDITTABLE{ }%
| %EDITCELL{ "editbutton, 1, Edit this table" }% ||
| *Header1* | *Header 2* |
| Blah, blah | blah, blah, blah |
| Blah, blah | blah, blah, blah |
%EDITTABLE{ }%
| %EDITCELL{ "editbutton, 1, Edit this other table" }% ||
| *Header 3* | *Header 4* |
| Blah, blah | blah, blah, blah |
| Blah, blah | blah, blah, blah |
--
EnriqueCadalso - 14 Oct 2008
Fixed
--
ArthurClemens - 02 Nov 2008
This is now in twiki.org's SVN,
TWikibug:Item6062
. Thanks
ArthurClemens.
--
PeterThoeny - 03 Nov 2008