I'm working with Content Search Web Parts, I need to run code when the queryTemplate process is done. So, I'm sending the query through a function
function sendQuery(myQuery) {
setQuery2(myQuery, function() {
console.log('Process done for setQuery2');
window.open('Customer.aspx', '_blank');
console.log('Process done');
});
}
function setQuery2( query, callbackFunction ) {
var ctrlA = $getClientControl( $("#containerDivA")[0] );
var ctrlB = $getClientControl( $("#containerDivB")[0] );
console.log('Set query');
var q = query;
q += ' proOrd:CurrR';
ctrlA.get_dataProvider().set_queryTemplate(q);
console.log('Running new query in A');
ctrlA.get_dataProvider().issueQuery();
ctrlB.get_dataProvider().set_queryTemplate(q);
console.log('Running new query in B');
ctrlB.get_dataProvider().issueQuery();
}
The expectation is to run the window.open when the setQuery2 has finished the process of querying the service but it is not working, is something wrong on it? Thanks for your help.