1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Custom Widget Designer Event Click

Custom Widget Designer Event Click

2 posts, 0 answered
  1. Paul
    Paul avatar
    24 posts
    Registered:
    16 May 2011
    04 Jul 2011
    Link to this post
    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
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    05 Jul 2011
    Link to this post
    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
2 posts, 0 answered