Custom Widget Designer Event Click

Posted by Community Admin on 03-Aug-2018 15:59

Custom Widget Designer Event Click

All Replies

Posted by Community Admin on 04-Jul-2011 00:00

I have a number of custom widgets that work as intended. However, for the sake of keeping things clean and consistent I want them to display the same Icon and "Enter Content" message in the body area before they have been edited as the in built telerik controls do.

In terms of html this is simply a case of adding the following section to the page load for when the control is empty:

1.<div class="sfAddContentWrp">
2.<a class="sfAddContentLnk sfContentBlockIcn">
3.<span>Enter content</span>
4.</a>
5.</div>

This renders correctly (see attached screen shot), but I cannot work out the code for the click event to cause the designer to pop up (as is the case with the generic telerik controls). This should work the same as clicking the "edit" link in the top right of the web part.

Anyone know what needs adding to do this?

Paul

Posted by Community Admin on 05-Jul-2011 00:00

Hi Paul,

The click is handled by ZoneEditor client component. We get the ids of the all empty controls and send then through IScriptDescriptor on the client. There we get the control by Id using jQuery jQuery('#' + controlId);

and then using jQuery bind() we attach to click event type where we execute a function that calls the "edit" using execCommand client method.

emptyControl.bind("click", dock: dockControl , function (event)
                    thisObject.execCommand("edit", event.data.dock);


You need to the the same in your custom control.

Kind regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed