0

Is there anyway to get the webpart properties from within a display template html file, such as the Title in the Appearance tab as shown below or any properties under the Advanced section.

I would like to the get the Title and a URL and render the title inside the control template.

enter image description here

Edit: Solved it. I set the Chrome type back to default then I used the jQuery from the Singh to get the Title that had the TitleURL attached to it.

  • What exactly are you trying to achieve? Export the properties so you could use them in code or just render their values on the page? – Damjan Tomic Feb 7 '17 at 21:19
  • I would like to get the title and render it within a div in the control template – Jared Young Feb 7 '17 at 22:02
0

You can use some jQuery inside your custom control display template to fetch the title element (like below)

var MainWebPartSelector = "#" + ctx.ClientControl.get_id();

var titleElement = $($(MainWebPartSelector).parent().siblings().find("h2.ms-webpart-titleText span")[0]);

But I admit, I too would be interested if there is anything "already available" within the control template.

  • Is there any way to get properties under the Advanced section? Thanks – Jared Young Feb 7 '17 at 22:22
  • 1
    Solved using this jQuery. See edit in post. – Jared Young Feb 8 '17 at 1:01
  • Glad to have helped! – Ransher Singh Feb 8 '17 at 15:07

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.