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