Appendix : Legacy Presto components : Mashables and Mashups : Views for Mashups and Mashables : Creating Pluggable Views or Libraries : Implement a Pluggable View Class : Pluggable View Classes: Using Mashable/Mashup Data : Formatting and Rendering Response Data
Formatting and Rendering Response Data
When the draw method renders the view, both the configuration object for that view and the DataTable with the mashable/mashup response are passed as parameters. This example retrieves the name of the column that was selected for this view from config.selectedColumn.
self.draw = function(dataTable, config){

var column = config.selectedColumn,
rows = Presto.view.getRows(dataTable,config.columns,{"flatten":"true"});

if(rows && rows.length && column){
el.empty();
el.append('<div
>' + column + '</div>');
rows.each(function(row, i){
el.append('<div
>' + row[column] + '</div>');
});
}
};
It retrieves the data to render and applies any configuration for the columns of this view to the data using the Presto.view.getRows method. Users define column configuration options in the Data Configuration step of the Business Analytics View Maker wizard. This configuration is stored in the columns property of view configuration.
Note:  
You can also obtain the raw data from the rows field in the DataTable.
The formatted data that is returned by Presto.view.getRows is an array of objects, each object representing one row of data for the dataset that the user selected for this view. (The dataset is selected in the Data Configuration step of the Business Analytics View Maker wizard.)
Finally, it steps through each row and appends the appropriate HTML to render the name of the column and the data in each row for that column. The preview of this view for a mashable with a column named Month would look like this:
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback