Has anyone tried to re-order rows within an editable table?
What we're trying to achieve is have a up and down button that moves a row either up or down within the table.
What we're trying to achieve is have a up and down button that moves a row either up or down within the table.
RE: Re-order editable table rows
I have had a look into this, and hopefully the attached script file should give you what you need.
Add this as an additional script file for your page after the existing editabletable.js one.
Then go and adjust the contents of the 'table_init' custom field to include an 'allow_reorder: true' setting. eg
hyf.editabletable.init(hyf.editabletable.getLastTableOutput(), {validate:true, allow_add:true, allow_delete:true, allow_edit:true, allow_reorder:true});
Hopefully if you now generated and deploy the page you should see up and down links on the end of each row which allow you to reorder the rows. The order of the resulting XML on the server should match what you see on screen.
You may want to style these buttons a bit (or add some images), but you should be able to do that with the the 'editabletable_up_btn' and 'editabletable_down_btn' classes.
I hope this helps. I haven't tested this extensively, so there may still be some issues, but hopefully it is useful! Also I have been using WebMaker v4, and although I think this will work on 3.1.2 as well, let me know if you have any issues.
One final point to note is that it is possible that this might be built in to the base editable table functionality at some point in the future. If this does happen, you would need to be sure to remove this extra script file when upgrading to this new latest version.
Regards,
Gerard
RE: Re-order editable table rows
Have you got the modified version of the editabletable.js that calls the new script correctly before we start adjusting ours?
Thanks
RE: Re-order editable table rows
You shouldn't have to make any changes to the base editabletable.js to get this to work.
Hopefully as long as you include this new file after the base one it should automatically hook in where needed.
Is this not working for you? Are you getting any script errors or anything?
Regards,
Gerard
RE: Re-order editable table rows
Found the problem - we had added it at application level rather than page level. Moving it appears to have fixed the problem.
Thanks you very much.