Hot answers tagged

2

Everything looks like it is working properly in your code, you are getting the data and manipulating the DOM. So that leaves why are you are seeing the results you are. That is because you are doing $('#postBody').text(curBody); instead of $('#postBody').html(curBody);. This is taking your data and making it raw text. Use the .html to make it literal html ...


2

An easy check for SharePoint Online or on premises would be to look at the host name. In the case of SharePoint Online, it will always be in the form of tenant.sharepoint.com. A local installation, third party hosted, or something running in Azure, it will be for all intents and purposes the same thing, an on premises installation. This then leads to how ...


1

Here's a small utility to attach properly to the SharePoint lifecycle. You use it like this: window.LifeCycleHelper.AttachToLoad(function(){ alert('Hello World'); }); Utility: //use an IIFE to create a scope and dont dirty the global scope (function (_) { // use strict to ensure we dont code stupid 'use strict'; var initHandlers = []; ...


1

Preferably you do not hardcode Fieldnames in your CSR code, so you can re-use your code or make it into a generic function This is more generic and easier to maintain: var name = ctx.CurrentFieldSchema.Name; var value = ctx.CurrentItem[name]; var percentage = value / 100; var color = 'red'; if (percentage >= .5) { color = 'orange'; } else if (...


1

The content type object is not loaded. So you need another round trip to the server to get the details as below function SuccessHandler(result) { var newshtml = ''; listItemEnumerator = collListItem.getEnumerator(); while (listItemEnumerator.moveNext()) { oListItem = listItemEnumerator.get_current(); var CT = oListItem....



Only top voted, non community-wiki answers of a minimum length are eligible