I'm working with api 3.31. I have an app that loads an onDemandGrid via a datastore that is loaded by a querytask. It works fine, except that I need to get attachments that exist in the source data, and put the attachment into a column that is added in the createGrid function: queryAttachmentsInfo does not seem to be available via the QueryTask. So I wonder if anyone has dealt with this problem of getting attachments into a datagrid, and perhaps any suggestions as to how I could populate the attachments column in this application's grid.
Here is the code that creates the grid:
function createGrid() {
var egrid = declare([ Grid, Keyboard, Selection]);
this.gridlist = new egrid({
selectionMode: 'single',
columns: {
NAME: "Name",
LIFE_CYCLE_STATUS: "Status",
HIGH_SIDE_VOLTAGE: "High Side Voltage",
OWNERSHIP_CODE: "Ownership",
ADDRESS: "Address",
CITY: "City",
COUNTY: "County",
STATE: "State",
Attachments: { label: "Attachments", formatter: makeLink}
},
showHeader: true,
collection: this.store,
minRowsPerPage: 200,
queryOptions: {
sort: [{ attribute: "NAME" }]
},
store: new Memory({data: [], idProperty: "id"})
}, "grid");
this.gridlist.startup();
And this is where I create the store:
function loadSubstations () {
var queryTaskSubstations = new QueryTask(facilityLayer.url);
var query = new Query();
query.returnGeometry = true;
query.outFields=["OBJECTID","NAME","CODE","HIGH_SIDE_VOLTAGE","LIFE_CYCLE_STATUS","OWNERSHIP_CODE","ADDRESS","CITY","COUNTY","STATE"];
query.where = "1=1";
queryTaskSubstations.execute(query, lang.hitch(this, showResults));
function showResults (results) {
var resultFeatures = results.features;
var featureCount = results.features.length;
for (var i = 0; i < featureCount; i++){
var features = results.features;
esubs.push(features);
}
var subs = arrayUtils.map(esubs, function (feature) {
return {
"id": feature.attributes["OBJECTID"],
"NAME": feature.attributes["NAME"],
"LIFE_CYCLE_STATUS": feature.attributes["LIFE_CYCLE_STATUS"],
"HIGH_SIDE_VOLTAGE": feature.attributes["HIGH_SIDE_VOLTAGE"],
"OWNERSHIP_CODE": feature.attributes["OWNERSHIP_CODE"],
"ADDRESS": feature.attributes["ADDRESS"],
"CITY": feature.attributes["CITY"],
"COUNTY": feature.attributes["COUNTY"],
"STATE": feature.attributes["STATE"],
"shape": feature.geometry
};
});
subdataStore = new Memory({data:subs, idProperty:"id"});
this.gridlist.set("store", subdataStore);
this.gridlist.set("collection", subdataStore);
}
}
Thanks,
Jim Faron