Need to handle a designer event...
I have a script called on document.ready for a control....so that's all awesome, but when I move the control to another dock zone the function needs to be triggered again...
Is there some way I can get that done aside from a timer?
Also I'd like to know how to handle the callback after "Save" has been completed...I need to run a script
Hello Steve,
As for the first question - how to handle moving a control from one placeholder to another:
First of all, you need to obtain the instance of the main JavaScript object that handles the page editor. This must be done in the onload event:
var
ze = $find(
"ZoneEditor"
);
ze.add_command(Function.createDelegate(
this
,
function
(sender, args)
if
(args.CommandName ==
"indexchanged"
)
//Do something here
));
If you want to do something on success(after the change is persisted successfully), you can do something like that:
ze._commandSuccessDelegate = Function.createDelegate(
this
,
function
(caller, data, request, context)
//Note, that here you are redefining the success delegate, so
//you need to invoke the default method at some place in order everything to be working
ze._commandSuccess(caller, data, request, context);
);
The second question - how to do something after the page is saved:
You can redefine the delegates for success, just like in the previous example. This time the object you need is the toolbar object. It handles Save Draft and Publish commands. It is defined in a file named EditorToolBar.js, if you need to look at it. You will have to redefine the following delegates:
editorToolBar._saveDraftSuccessDelegate - this is invoked after successfully saving the page as draft.
editorToolBar._publishDraftSuccessDelegate - this is invoked after successfully publishing the page.
I hope this answers your questions.