Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

_spBodyOnLoadFunctions.push failing with the default sharepoint view pagination

$
0
0

Hi,

I'm using _spBodyOnLoadFunctions.push(handleEvents)  to capture event from the SharePoint view page and updating the list values.

In the SharePoint view first page my Jquery is running perfectly and updating the list. when i click on the next page the event is not firing and no update to the list items.

Anyone please help me as this issue is on priority..

Here is my script

function handleEvents()
{
   $("input[name='teamCheckbox']").change(function() {
	var controlid = $(this).attr("id");
	var parts = controlid.split('_');
	var itemID = parts[1];
	clientContext = new SP.ClientContext(_spPageContextInfo.webAbsoluteUrl);
	var list = clientContext.get_web().get_lists().getById(_spPageContextInfo.pageListId);
	item = list.getItemById(itemID);
	clientContext.load(item, 'Status');
	clientContext.executeQueryAsync(Function.createDelegate(this, LoadStatus), Function.createDelegate(this, onQueryFailed));
      });
} 

function LoadStatus() {
	reviewStatus = item.get_item('Status');
	if(reviewStatus)
	{			
		item.set_item('Status', 0);
		item.update();
		clientContext.load(item);		clientContext.executeQueryAsync(Function.createDelegate(this, UpdateNo), Function.createDelegate(this, onQueryFailed));
	}else
	{
		item.set_item('Status', 1);
		item.update();
		clientContext.load(item);		clientContext.executeQueryAsync(Function.createDelegate(this, UpdateYes), Function.createDelegate(this, onQueryFailed));
	}
}

function onQueryFailed() {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }

function UpdateYes(){
	reviewStatus = null; }

function UpdateNo(){
	reviewStatus = null;}

_spBodyOnLoadFunctions.push(handleEvents);


P N Bharath



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>