I have this now, but the error that gives me its pagination. How can i activate pagination on the service?
define(["dojo/_base/declare",
"dojo/_base/lang",
"esri/map",
"esri/InfoTemplate",
"esri/layers/FeatureLayer",
"esri/dijit/Search",
"dojo/dom",
"esri/tasks/query",
"esri/tasks/QueryTask"],
function(declare,
lang,
Map,
InfoTemplate,
FeatureLayer,
Search,
dom,
Query,
QueryTask) {
return declare(null, {
search:null,
map: null,
fLayerDist: null,
fLayerTrans: null,
fLayerComuna: null,
constructor: function(map){
this.map = map;
},
initLayers: function(){
this.fLayerDist = new FeatureLayer("",{
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
});
this.fLayerTrans = new FeatureLayer("",{
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
});
this.fLayerComuna = new FeatureLayer("", {
outFields: ["ALIMENTADOR"]
});
this.map.addLayers([this.fLayerDist,this.fLayerTrans]);
},
initSearch: function(){
this.search = new Search({
map: this.map,
sources: [],
zoomScale: 10000000
}, "search");
//listen for the load event and set the source properties
this.search.on("load", lang.hitch(this, function(){
var sources = this.search.get("sources");
/*sources.push({
featureLayer: this.fLayerComuna,
placeholder: "Argentina",
enableLabel: false,
searchFields: ["nombre_calle"],
displayField: "nombre_calle",
exactMatch: false,
outFields: ["nombre_calle"],
//Create an InfoTemplate and include three fields
infoTemplate: new InfoTemplate("Ecological Footprint", "</br></br>Country: ${nombre_calle}</br>Rating: ${nombre_calle}")
});
*/
sources.push({
featureLayer: new FeatureLayer(""),
searchFields: ["CODIGO_SAP"],
displayField: "CODIGO_SAP",
exactMatch: false,
outFields: ["CODIGO_SAP", "SOLICITANTE", "MONTO_PAGO"],
name: "MANTENIMIENTO_SOLICITUD_PODAS",
placeholder: "1234",
maxResults: 6,
maxSuggestions: 6,
//Create an InfoTemplate and include three fields
infoTemplate: new InfoTemplate("Congressional District", "District ID: ${CODIGO_SAP}</br>Name: ${SOLICITANTE}</br>Party Affiliation: ${MONTO_PAGO}"),
enableSuggestions: true,
minCharacters: 0
});
//Set the sources above to the search widget
// this.search.set("sources", sources);
this.search.set("sources", sources);
}));
// this.search.startup();
this.search.startup();
},
initOptions: function(){
var queryTask = new QueryTask("");
var query = new Query();
query.returnGeometry = false;
query.outFields = ["nombre"];
query.where= "1=1";
queryTask.execute(query, function(results){
document.getElementById("id_comuna_dmps").innerHTML = "";
var submenu = new Array();
var resultItems = [];
var resultCount = results.features.length;
var x = document.getElementById("id_comuna_dmps");
for (var i = 0; i < resultCount; i++) {
var featureAttributes = results.features.attributes;
for (var attr in featureAttributes) {
var c = document.createElement("option");
c.text = featureAttributes[attr];
x.options.add(c, attr);
}
//resultItems.push("<br>");
}
});
}
});
});