Could you help me, please to show domain in dgrid, this is functionally in infowindow but in grid puts the code, not the description.of domain.
var outFieldsProy = ["PROYECTO", "NOMBRE", "ESC250", "AERONAVE"]
var gridProy = new (declare([Grid, Selection,ColumnHider, ColumnReorder, ColumnResizer]))({
bufferRows : Infinity,
columns : {
PROYECTO : "Proyecto",
NOMBRE : "Nombre",
ESC250 : "Escala 250",
AERONAVE : "Aeronave"
}
}, "divGrid");
function populateGrid(results) {
// var gridData;
dataQuakes = arrayUtils.map(results.features, function (feature) {
return {
"PROYECTO": feature.attributes[outFieldsProy[0]],
"NOMBRE": feature.attributes[outFieldsProy[1]],
"ESC250": feature.attributes[outFieldsProy[2]],
"AERONAVE": feature.attributes[outFieldsProy[3]]
};
});
var memStore = new Memory({
data: dataQuakes
});
gridProy.set("store", memStore)
}
Thanks
you should find something here QueryTask and coded domain values
Thank you thejus kambi
This function _getCodedValue: function (layer, fieldName, fieldValue, typeID) must be before this?:
function populateGrid(results) { // var gridData; dataQuakes = arrayUtils.map(results.features, function (feature) { return { "PROYECTO": feature.attributes[outFieldsProy[0]], "NOMBRE": feature.attributes[outFieldsProy[1]], "ESC250": feature.attributes[outFieldsProy[2]], "AERONAVE": feature.attributes[outFieldsProy[3]] }; });
and other question, ¿which is typeID?
Regards
Ignore that as you might not have it. It is to be use when you have a subtypes in FeatureLayer.
You can use the fields property of the query result. Select the field which has domain.
var field = results.fields["< field name >"]
var codedValueDomain = field.domain;
and use this domain and get the code value, while looping through the features and prepare the data for grid.
I´m sorry, but I have other question.
My query result is a featureset. how can I convert this to fields type?
//Inicializa el query var queryProy = new Query(); queryProy.geometry = geometryInput; //Wire the layer's selection complete event operationsPolygonLayer.on("selection-complete", populateGrid); // Transforma la selección operationsPolygonLayer.selectFeatures(queryProy, FeatureLayer.SELECTION_NEW);
because
var field = results.fields["AERONAVE"];
is undefined
Thanks again
Regards
I thought you are using QueryTask to get the results. Now I see you are using featureLayer. The FeatureLayer has fields property use that instead.
I am having a hard time getting coded domains to show up.
What part of the code did you put this into:
var field = feature.fields["<Priority>"] |
var codedValueDomain = field.domain;
I am using this template
Hello Rickey,
You need to do if before you set the data to dgrid. like below
statesLayer.on("load", function(evt) { var query = new Query(); query.where = "1=1"; evt.layer.queryFeatures(query, function(featureSet) { var items = array.map(featureSet.features, function(feature) { var attributes = lang.clone(feature.attributes); var fields = statesLayer.fields; //Replace the attributes values for domain values here. return attributes; }); //idProperty must be set manually if value is something other than 'id' var memStore = new Memory({ data: items, idProperty: "ObjectID" }); window.grid.set("store", memStore); window.grid.set("sort", "STATE_NAME"); grid.on(".field-ObjectID:click", function(e) { //retrieve the ObjectId when someone clicks on the magnifying glass if (e.target.alt) { zoomRow(e.target.alt); } }); }); });
Thejus
I get an error of:
Cannot read property '<Priority>' of undefined
where priority is my field name
you should try without the "<" ">" signs. also feature does not contain the fields property. if you see my code, I am getting the fields from the stateLayer and not feature.