2

I am implementing this : Additional info for a Component Presentation for controlling a Page layout outside Tridion by custom GUI extension. That is adding a custom tab for every component presentation. (Second option that Mihai Cădariu has suggested in his answer).

This custom tab works fine except one hitch. When we save the Component presentation metadata to the APP_DATA table, we fire the data save to DB by extending the OnSave command. However for new pages, the page ID is not generated when we push the data to the DB. This causes a error of invalid page URI since the save to DB method is getting called before the page save is completed.

Is there any way to wait until page save is completed and then push the data to the DB? I have to implement this through Anguilla UI extension only.

  • Is it possible to wait for the browser's httpresponse to know that the page save transaction is over and then trigger the data push to DB? – Keirthana May 9 '14 at 12:14
3

This is a common problem indeed. The usual approach to solving it is through a data extender. You validate and save the information you need in the context object in ProcessRequest (for the relevant commands, i.e. SaveItem and SaveNewItem) and then actually save the Application Data in the resulting ProcessResponse call.

That way you only save the application data if the save of the item succeeded (and thus the item exists).

However, if you want to keep this in the client-side code only - you'd want to hook into the event that occurs after the model item has been updated.

  • Thanks for your inputs. We do want to keep this on the client side only. We have used data extender to extend the Save command and OnSave we are triggering a service call that will store the data in the APP_DATA table,from the client side JavaScript. We do want to do this from the client side JS only. //you'd want to hook into the event that occurs after the model item has been updated// Is there any event that can triggered for this situation? Can you elaborate a bit more? Thanks! – Keirthana May 12 '14 at 6:01
  • The model object has a "save" event that it fires. You can hook into it like so: $evt.addEventHandler(item, "save", this.getDelegate(this.yourEventHandlerHere)); – Peter Kjaer May 12 '14 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.