I have tried to create a report using the report dijit and keep getting the following error "Create widget error widgets/Report/Widget". I've explored the following example with no luck Create a custom widget using the Report dijit—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS...
Below is my widget.js:
define(['dojo/_base/declare', 'jimu/BaseWidget', 'jimu/dijit/Report', 'jimu/dijit/PageUtils'],
function(declare, BaseWidget, Report, PageUtils) {
//To create a widget, you need to derive from BaseWidget.
return declare([BaseWidget], {
// DemoWidget code goes here
//please note that this property is be set by the framework when widget is loaded.
//templateString: template,
baseClass: 'jimu-widget-report',
postCreate: function() {
this.inherited(arguments);
console.log('postCreate');
},
startup: function() {
this.inherited(arguments);
this.report = new Report ({
footNotes: "Reported Generated by Terracon"
printTaskUrl: "http://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task",
reportLayout: {
"pageSize": PageUtils.PageSizes.A4,
"orientation": PageUtils.Orientation.Landscape
}}
});
console.log('startup');
}}
_onBtnPrintClicked: function(){
var printData = [
{
addPageBreak: true,
type: "map",
map: this.map
},
{
title: "List of parks",
addPageBreak: false,
type: "table",
tableCols: 3,
data: {
showRowIndex: false,
rows: [["Brookside Park", "1630 Brookside Avenue, Redlands, CA 92373", "34.045347, -117.209909"],
["Crafton Park", "Wabash Ave & Independence Ave, Redlands, CA 92374", "34.060946, -117.140118"],
["Ford Park", "Parkford Dr & Redlands Blvd, Redlands, CA 92374", "34.043828, -117.160692"],
["Prospect Park", "352 Prospect Dr., Redlands, CA 92373", "34.039145, -117.172582"],
["Sylvan Park", "601 N University St, Redlands, CA 92374", "34.059977, -117.168179"]],
cols: ["Name", "Address", "Lat/Lon"]
}
},
{
title: "Photos",
type: "html",
data: '<div style="height: 450px;"><div style="width: 250px; margin-left: 10px; float: left;"><div><img style="width: 250px; height: 200px; float: left;" src="http://cityofredlands.org/sites/default/files/rda/Landmarks/brookside.jpg" /></div><div style="text-align:center; margin-bottom: 10px;">Brookside Park</div></div>'+
'<div style="width: 250px; margin-left: 10px; float: left;"><div><img style="width: 250px; height: 200px; float: left;" src="http://cityofredlands.org/sites/default/files/rda/Landmarks/Crafton.jpg" /></div><div style="text-align:center; margin-bottom: 10px;">Crafton Park</div></div>'+
'<div style="width: 250px; margin-left: 10px; float: left;"><div><img style="width: 250px; height: 200px; float: left;" src="http://cityofredlands.org/sites/default/files/rda/Landmarks/ford-park.jpg" /></div><div style="text-align:center; margin-bottom: 10px;">Ford Park</div></div>'+
'<div style="width: 250px; margin-left: 10px; float: left; clear:left;"><div><img style="width: 250px; height: 200px; float: left;" src="http://cityofredlands.org/sites/default/files/rda/Landmarks/Prospect%20park.jpg" /></div><div style="text-align:center; margin-bottom: 10px;">Prospect Park</div></div>'+
'<div style="width: 250px; margin-left: 10px; float: left;"><div><img style="width: 250px; height: 200px; float: left;" src="http://cityofredlands.org/sites/default/files/rda/Landmarks/Sylvan%20Park.jpg" /></div><div style="text-align:center; margin-bottom: 10px;">Sylvan Park</div></div></div>'
}];
this.report.print("Redlands Parks", printData);
},
Any ideas?
Thanks
Solved! Go to Solution.
Perfect it works! Thanks.
How do I grab data from a feature layer on AGOL and plunk that into the table? Same goes for the pictures (which are attachments to my inspection points).
Glad it works. Please don't forget to mark the question as answered.
How do I grab data from a feature layer on AGOL and plunk that into the table? Same goes for the pictures (which are attachments to my inspection points).
I have not used the Report dijit, but have you seen the documentation?
I will review thanks.