views:

4

answers:

0

How can i load a list of items and preload some properties op a lookupvalue column?

See this sample. I want to load Company.CompanyWebsite property (companywebsite is a property of the Company custom list)

var list = this.Web.get_lists().getByTitle("Comments");
var camlQuery = new SP.CamlQuery();

var q = '<View></View>';        
camlQuery.set_viewXml(q);
this.listItems = list.getItems(camlQuery);
this.SPContext.load(listItems, 'Include(Title,Author,Company.CompanyWebsite)');

this.SPContext.executeQueryAsync(Function.createDelegate(this, this.onListItemsLoadSuccess), Function.createDelegate(this, this.onQueryFailed));