Lei Zhao
The cols should be your fields name/alias and rows should the values for each field in a feature.
For e.g:
//Cols should be an array of strings which will be used to show table column title
cols: ["Name", "Address", "Lat/Lon"],
//Rows should be an array of array (strings) which will be used to show values in each row
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"]
]
So in this example we have three columns - "Name", "Address", "Lat/Lon" and 5 rows each row is array for values in each col.
For more details please see this link
I Have updated the onReceiveData method to populate the this.rowItem and this.colItem in your case.
onReceiveData: function(name, widgetId, data, historyData) {
if(widgetId === 'widgets_test_36') {
console.log("Report widget got the message");
this.rowItem = [];
this.colItem = [];
var resultCount = data.queryResult.length;
for (var i =0; i<data.queryResult.length; i++) {
var resultItems = [];
var featureAttributes = data.queryResult[i].attributes; //each row record
//The next is to handle fields of each record and push them into resultItems
for (var attr in featureAttributes){
//Show Column titles as Field name
if(this.colItem.length === 0){
this.colItem
.push(attr);
}
//Show Values in rows
resultItems.push(featureAttributes[attr]);
}
//Add each row in rowItem
this.rowItem.push(resultItems);
console.info(this.rowItem);
}
}
}