4

I am retrieving my dynamic Component from the Broker and using its field in my view (cp view), to display content using DD4T and MVC4. Now, I am facing difficulties while trying to setup SiteEdit for my dynamic managed content. I can not use the standard method where I can pass my static CP (included in Page) as model to the method SiteEditComponentPresentation.

I am trying with the following method as well, but not able to:

public static MvcHtmlString SiteEditComponentPresentation(this HtmlHelper helper, IComponent component, string componentTemplateId, bool queryBased, string region);

In my case: @Html.SiteEditComponentPresentation(Component, "tcm:xx-yyyy-32",true,"")

And then for each field: @Html.SiteEditField(Component, Component.Fields["fieldName"])

Can you please tell me what is wrong or what exact value I should give in region? Is there any other way to work in similar scenarios? Any suggestion will help me.

update

The particular section I am not able to edit is coming from an ajax call, inside a <div> the whole content of the dynamic view is getting populated in something like: <div id="divContent"></div>, where divContent is my dynamic HTML getting linked to my actual page.

In the dynamic view I am using a non-tridion model, but for some section I am calling the broker to retrieve Component where I need site-edit enabled.

7
  • 1
    do you get an error, or can you just not edit your dynamic component ? If you don't get an error, but you can't edit the component, check the source of your page, and check if you see any SiteEdit html comments surrounding your component fields. Commented Sep 2, 2014 at 8:24
  • Here, the particular section I am not able to edit is coming from ajax call, inside a <div> the whole content of the dynamic view is getting populated in something like : <div id="divContent"></div>, where divContent is my dynamic html getting linked to my actual page. In the dynamic view I am using a non-tridion model, but for some section I am calling the broker to retrieve Component where I need site-edit enabled. Please let me know if you need any further information. Commented Sep 2, 2014 at 8:49
  • you mean that your dynamic component content is inserted via ajax in a div ? Commented Sep 2, 2014 at 8:54
  • yes, partly. The view is getting called from the actual view ((Ajax/Action/Child-View/MainView). In child view, i am calling broker to retrieve some information which are coming from Tridion. Commented Sep 2, 2014 at 8:59
  • and does your html inserted via ajax contain SiteEdit comments ? if it does, it might be possible that siteedit is already initialized at the moment your div is populated via ajax. You should try and debug via firebug/chrome dev tools. I see in the siteedit javascript code this function is called on page load : SDL.Client.Application.initialize(); Commented Sep 2, 2014 at 9:06

1 Answer 1

3

XPM (aka. SiteEdit) works by indexing the page for XPM markup to build a list of which Component Presentations are on the page. This indexing is done right after the HTML is loaded (similar to the onload event on the body).

So the problem you are experiencing seems to be related to the additional information which you gave in your first comment. You load additional data on the page through ajax, at a time when the page has already been indexed.

It is currently not possible to trigger a reindex of the XPM markup after this has been done. It is hardwired to be done right after the HTML page is fully loaded for the first time. So at this time, XPM does not support editing content added through ajax on your page.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.