Get Multiple list Data using ECMA in a Single Hit.
function GetRegisteredSoft() {
//
debugger;
clientContext = new
SP.ClientContext.get_current();
var camlQuery = SP.CamlQuery.createAllItemsQuery();
$.each(list, function (index, lstName) {
//
debugger;
var oList =
clientContext.get_web().get_lists().getByTitle(lstName);
$("body").data(lstName, oList.getItems(camlQuery));
clientContext.load($("body").data(lstName));
});
clientContext.executeQueryAsync(
Function.createDelegate(this, this.retrieveSoftwareInfoListItemsSuccess),
Function.createDelegate(this, this.retrieveSoftwareInfoListItemsFail));
}
function retrieveSoftwareInfoListItemsSuccess() {
//debugger;
$.each(list, function (index, lstName) {
//debugger;
var result = $("body").data(lstName);
var empBasicInfoListItemEnumerator = result.getEnumerator();
while (empBasicInfoListItemEnumerator.moveNext()) {
var oListItem = empBasicInfoListItemEnumerator.get_current();
var olistItemSoftware = oListItem.get_item('SoftwareName');
//alert(olistItemSoftware);
if (olistItemSoftware != null) {
availableTags.push(oListItem.get_item('SoftwareName'));
}
}
});
for (var i = 0; i < availableTags.length; i++) {
option += '<option value="' +
availableTags[i] + '">' + availableTags[i] + '</option>';
}
option += '<option
value="Other">Other</option>';
$('#ddlSoftReq').append(option);
}
Comments