0

I'm trying to understand what the XSLRender flag in the SharePoint-Enterprises CSR stands for, did not find anything on the web.
Does anybody have an idea/explanation?
Where does it come from?

EDIT:
The point is that I developed a custom field, extending the SPFieldLookup and as control an extended EntityEditorWithPicker one. To generate the HTML output I overrode the mehtods CreateChildControls and OnPreRender. It works fine, but I need to customize the output on listviews (New, Edit and Dispforms are fine). In the SPFieldLookup there is the possibility to override the JSLink property, doing this the listview shows the right result, but the CreateChildControls and OnPreRender methods are skipped and the html output is a simpe input element with the value inside.

So how can I customize the view output of an custom extended SPField?

I already know CSR, but it can not be used in this case, since it requires to specify the column name, which varies.

1 Answer 1

0

XSLRender is a boolean flag to use a custom xslRenderer or not. This article explains the overall process well and references the XSLRender flag. https://threewill.com/client-side-rendering-sharepoint-2013/

if (field.XSLRender == '1') {
renderingTemplateToUse = new RawFieldRenderer(field.Name);
}

Relevant section of use is above. But I'll be darned if I can find the actual MSDN reference for the which client field it's pulling that boolean from.

Edit: From another StackExchange question Sharepoint 2013 JS Link return default field rendering

Apparently this stuff isn't documented anywhere and kind people have just shared information

Edit: Well that's an entirely different question now...

In that case, to keep things simple, I'd use the XSL Link property and make sure part of the field deployment deployed the XSL File with it. XSL Transformation is a pretty simple way to handle output of information.

When you are working with custom content types and custom site columns, you can reference the field type or the Static Name of the column.

Here's a reference to someone else doing it, then using it in a list. Creating Site column with a custom SPFieldType

6
  • I updated a 'bit my question.
    – Emaborsa
    Aug 23, 2018 at 6:09
  • I'm sorry, but I don't understand how/why this Creating Site column with a custom SPFieldType is related with my question...
    – Emaborsa
    Aug 27, 2018 at 6:02
  • This is the question you posted. "how can I customize the view output of an custom extended SPField?" There are multiple ways to control how your Fields/Columns render in a list view. 1. On Page load via XSL templates, either individually or through an XSLLink (my XSL is over here) 2. During CreateChildControls, or some other suitable override. 3. Using CSR, which I think you are actually using. "XSLRender" is a boolean (true/false) to say use a custom renderer. if that flag is True, and you don't have one, you'll get a default Renderer.
    – Jack
    Aug 27, 2018 at 11:02
  • 1. Don't want to create a js file for each list I add the custom as my custom field. 2 CreateChildControls (as fa I know) does not control listview, only forms. 3. If a JSLink is defined, CreateChildControls is skipped.
    – Emaborsa
    Aug 27, 2018 at 15:09
  • So if you set XSLRender to False, and make sure the JSLink is empty or null, then your CreateChildControls should be hit just fine. It should also prevent anyone from overriding the display. If that doesn't do it. Take a look at this. docs.microsoft.com/en-us/dotnet/api/… and see if it helps. To me, this reads like it will execute later in the process and maybe bypass the ListView changes.
    – Jack
    Aug 28, 2018 at 16:33

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.