Skip to content

Instantly share code, notes, and snippets.

@mtoonen
Last active August 29, 2015 14:03
Show Gist options
  • Save mtoonen/491fadaf0efb5318a4d5 to your computer and use it in GitHub Desktop.
Save mtoonen/491fadaf0efb5318a4d5 to your computer and use it in GitHub Desktop.
Dynamisch zoeken
registerAtSearch: function() {
var searchComps = this.viewerController.getComponentsByClassName("viewer.components.Search");
// Registreer bij 1 Search: kan fout gaan omdat namen veranderen
// this.viewerController.getComponentByName("print1");
for (var i = 0; i < searchComps.length; i++) {
searchComps[i].addDynamicSearchEntry(this, this.callback);
}
},
callback : function(term,searchRequestId){
var result = {
type: "aap",
label: "Noot",
location:{
minx:111490, maxx: 175001, miny: 437082, maxy: 481536
}
};
var returnValue = {
success : true,
errorMessage: "Oops, something went wrong here.",
results: [result],
searchRequestId: searchRequestId
};
return returnValue;
}
myCallback : function(term,searchRequestId){
var result = {
type: <String>,
label: <String>,
location:{
minx:<double>, maxx: <double, miny: <double>, maxy: <double>
}
};
var returnValue = {
success : <boolean>,
errorMessage: <String>,// only handler when success === false
results: <Array van Results>,
searchRequestId: searchRequestId
};
return returnValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment