Jump to:

5537 Posts in 1737 Topics by 1223 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Save multiple Records from a TableField

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 533 Views
  • cornJ
    Community Member
    3 Posts

    Save multiple Records from a TableField Link to this post

    Most probably a stupid question again:

    I have a Form with a TableField in the CMS where a user can modify the values of a set of records at the same time. Now how do I (elegantly) save the changes back to the database?

    My first attempt was to loop over the returned data, get every changed DataObject via its ID and save the changed data. This works... but there is a prettier way, isn't there?

    Anyway if not, I still got one problem: The Form recognizes the changes setting the status to unsaved (in javascript). But it does not recognize the save action. Becaus the saveing is done with ajax i have to put some javascript into my answer telling the form to set the status back to saved, so the anoying "not saved warning" does not appear on leaving the page.

    showMessage("Saved") shows the message, I found out. But what snippet changes the status?

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.