Refresh Widget UI in Page Editor
How can I make my widget display user changes from custom control designer...
like the out-of-the-box Content Block where after hitting "Save", will render the content in the Page Editor, I guess it is leveraging
- Services/Pages/ControlPropertyService.svc
- Services/Pages/ZoneEditorService.svc
how can I expose the properties to these methods or have the properties accesible to re-render them on the Page Editor, or populate the Html property of the JSON object, as I saw the Content Block use this value to render... or hook on some javascript event to re-render the widget UI...
hope I explained my need somewhat concisely...
Hello Readonlychild,
When you edit a widget and change it we do not refresh the entire page - it does not go to its entire lifecycle. In your custom control designer you can place the following code in the _saveChangesSuccess handler:
window.top.zoneEditorShared.set_isPageRefreshControlled(true);
before the line for window refresh:
window.parent.location.href = window.parent.location.href;
so when you click "Save" this should show your changes. We use the same approach when you change the template and force the page to go to its lifecycle, so you will see the changes.
All the best,
Ivan Dimitrov
the Telerik team
Thanks Ivan,
could you give me a little more reference, on how to implement the _saveChangesSuccess handler,
I've yet only used refreshUI and applyChanges on my custom controls.
Hello Readonlychild,
You need to use a delegate inside the client component
this._saveChangesSuccessDelegate = null;
this._saveChangesSuccessDelegate = Function.createDelegate(this, this._saveChangesSuccess);
_saveChangesSuccess: function (caller, sender, args)
,
Take a look at this post - forums.asp.net/.../3068730.aspx
All the best,
Ivan Dimitrov
the Telerik team