Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Broly
Contributor III
Contributor III

ag-grid and hypercube

Hello all,

 

I am currently in a difficult spot, so I was wondering if you could help me out?

I am trying to use ag-grid, and this current status:

//ag-grid.html

<!DOCTYPE html>
<html lang="en">
<head>
<title>Ag-Grid Basic Example</title>
<script src="https://unpkg.com/ag-grid-community/dist/ag-grid-community.min.js"></script>
<script src="ag-grid.js"></script>
</head>
<body>
<button onclick="getSelectedRows()">Get Selected Rows</button>
<div id="myGrid" style="height: 600px;width:500px;" class="ag-theme-balham"></div>
</body>
</html>

//ag-grid.js

var columnDefs = [
{headerName: "Make", field: "make", sortable: true, filter: true, checkboxSelection: true },
{headerName: "Model", field: "model", sortable: true, filter: true },
{headerName: "Price", field: "price", sortable: true, filter: true }
];

// specify the data
var rowData = [
{make: "Toyota", model: "Celica", price: 35000},
{make: "Ford", model: "Mondeo", price: 32000},
{make: "Porsche", model: "Boxter", price: 72000}
];

// let the grid know which columns and what data to use
var gridOptions = {
columnDefs: columnDefs,
rowData: rowData,
rowSelection: 'multiple'
};

// setup the grid after the page has finished loading
document.addEventListener('DOMContentLoaded', function() {
var gridDiv = document.querySelector('#myGrid');
new agGrid.Grid(gridDiv, gridOptions);
});

function getSelectedRows() {
var selectedNodes = gridOptions.api.getSelectedNodes()
var selectedData = selectedNodes.map( function(node) { return node.data })
var selectedDataStringPresentation = selectedData.map( function(node) { return node.make + ' ' + node.model }).join(', ')
alert('Selected nodes: ' + selectedDataStringPresentation);
}

 

and what I would like to do is to put into chart values from hypercube which was created using editor

//hypercube

/*
* Basic responsive mashup template
* @owner Enter you name here (xxx)
*/
/*
* Fill in host and port for Qlik engine
*/
var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
} );

require( ["js/qlik"], function ( qlik ) {
qlik.setOnError( function ( error ) {
$( '#popupText' ).append( error.message + "<br>" );
$( '#popup' ).fadeIn( 1000 );
} );
$( "#closePopup" ).click( function () {
$( '#popup' ).hide();
} );

//callbacks -- inserted here --
function wololo(reply, app){}

//open apps -- inserted here --
var app = qlik.openApp('4d6402a6-e321-455d-a03d-3632e1681bb8', config);

//get objects -- inserted here --

//create cubes and lists -- inserted here --
app.createCube({
"qInitialDataFetch": [
{
"qHeight": 20,
"qWidth": 2
}
],
"qDimensions": [
{
"qLabel": "Date",
"qLibraryId": "517d8d3b-6ddf-4496-a285-6c066b7eecd9",
"qNullSuppression": true,
"qOtherTotalSpec": {
"qOtherMode": "OTHER_OFF",
"qSuppressOther": true,
"qOtherSortMode": "OTHER_SORT_DESCENDING",
"qOtherCounted": {
"qv": "5"
},
"qOtherLimitMode": "OTHER_GE_LIMIT"
}
}
],
"qMeasures": [
{
"qLabel": "Last Reload Failure",
"qLibraryId": "74501d19-300d-4a0e-a43a-9e8543588783",
"qSortBy": {
"qSortByState": 0,
"qSortByFrequency": 0,
"qSortByNumeric": 0,
"qSortByAscii": 1,
"qSortByLoadOrder": 0,
"qSortByExpression": 0,
"qExpression": {
"qv": " "
}
}
}
],
"qSuppressZero": true,
"qSuppressMissing": true,
"qMode": "S",
"qInterColumnSortOrder": [],
"qStateName": "$"
},wololo);
} )

 

Can anyone point me to a solution, or provide some insight?

Thank you

Labels (3)
0 Replies