Sunday, 21 August 2011

Load Selected list using Javascript client Object model in Sharepoint 2010


I had some issues the other day to Retrive ang Load the selected (the list where items are being selected) using my  Javascript client Object model script.

Here is a short Tip on how to get the List because SP.ListOperation.Selection.getSelectedList() retruns you the GUID and not the actual list.

var context = SP.ClientContext.get_current();
var web = context.get_web();
context.load(web);
var currentlibid = SP.ListOperation.Selection.getSelectedList();
var currentLib = web.get_lists().getById(currentlibid);
context.load(currentLib);

Ads by Google

No comments:

Post a Comment