Created
March 1, 2017 16:12
-
-
Save mindspank/08c66496a21e76fad7ad061328d6ba50 to your computer and use it in GitHub Desktop.
sessionpage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['qlik', 'qvangular'], function (qlik, qv) { | |
return { | |
initialProperties: { | |
version: 1, | |
qHyperCubeDef: { | |
qSuppressZero: true, | |
qSuppressMissing: true, | |
qInitialDataFetch: [{qTop: 0, qLeft: 0, qWidth: 2, qHeight: 200}] | |
} | |
}, | |
definition: { | |
type: "items", | |
component: "accordion", | |
items: { | |
dimensions: { | |
uses: "dimensions" | |
}, | |
measures: { | |
uses: "measures" | |
}, | |
sorting: { | |
uses: "sorting" | |
}, | |
appearance: { | |
uses: "settings" | |
} | |
} | |
}, | |
paint: function ($element, layout) { | |
const app = qlik.currApp(); | |
app.model.enigmaModel.createSessionObject({ | |
qInfo: { | |
qId: '', | |
qType: 'myobj' | |
}, | |
qHyperCubeDef: { | |
qDimensions: [{ qDef: { qFieldDefs: ['TransID']}}], | |
qMeasures: [{qDef: {qDef: '=1'}}], | |
qSuppressZero: true, | |
qSuppressMissing: true, | |
qInitialDataFetch: [{qTop: 0, qLeft: 0, qWidth: 2, qHeight: 200}] | |
} | |
}).then(model => { | |
model.getLayout().then(layout => { | |
const columns = layout.qHyperCube.qSize.qcx; | |
const pageheight = Math.floor(10000 / columns); | |
const numberOfPages = Math.ceil(layout.qHyperCube.qSize.qcy / pageheight); | |
var promises = Array.apply(null, Array(numberOfPages)).map(function (data, index) { | |
var page = { | |
qTop: (pageheight * index) + index, | |
qLeft: 0, | |
qWidth: columns, | |
qHeight: pageheight | |
}; | |
return model.getHyperCubeData('/qHyperCubeDef', [page]); | |
}, this) | |
Promise.all(promises).then(function (data) { | |
console.log(data) | |
}); | |
}); | |
}) | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment