How to refresh List View in SharePoint 2013 using JavaScript

One of the short tip to refresh the list view using JavaScript code is as below:

// Set Ajax refresh context
var evtAjax = {
  currentCtx: ctx,
  csrAjaxRefresh: true
};
// Initiate Ajax Refresh on the list
AJAXRefreshView(evtAjax, SP.UI.DialogResult.OK);

You can place this code after completing your operation on list item or on success method. Where ctx is the current site context.

var ctx = SP.ClientContext.get_current();

This code usually helps in Client Side Rendering (CSR) / JSLink.

Keep SharePointing!

Advertisements

Delay in function Calling with SP.js context

Hi guyz,

Quick tips about calling delay in function with SP.js context.

SP 2013:

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () {
   alert("Ready");
});

SP 2010:

ExecuteOrDelayUntilScriptLoaded(function () {
   alert("Ready");
}, "sp.js");

There is difference in both of the version.

Blog more, Help more..!

Cheers!