Skip to content

Commit

Permalink
fix: set style rows to 5000
Browse files Browse the repository at this point in the history
  • Loading branch information
Caele committed Jan 5, 2021
1 parent 2dd11ad commit 3397bd4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 29 deletions.
46 changes: 18 additions & 28 deletions src/dataset.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import qlik from "qlik";
import qlik from 'qlik';

function createCube(definition, app) {
return new Promise((resolve) => {
function createCube (definition, app) {
return new Promise(resolve => {
app.createCube(definition, resolve);
});
}

async function buildDataCube(
originCubeDefinition,
originCube,
app,
requestPage
) {
async function buildDataCube (originCubeDefinition, originCube, app, requestPage) {
const cubeDefinition = {
...originCubeDefinition,
qInitialDataFetch: [
Expand All @@ -20,11 +15,11 @@ async function buildDataCube(
qTop: requestPage === undefined ? 0 : requestPage[0].qTop,
qLeft: 0,
qHeight: 1000,
qWidth: originCube.qSize.qcx,
},
qWidth: originCube.qSize.qcx
}
],
qDimensions: [originCubeDefinition.qDimensions[0]],
qMeasures: originCubeDefinition.qMeasures,
qMeasures: originCubeDefinition.qMeasures
};
if (originCube.qDimensionInfo.length === 2) {
cubeDefinition.qDimensions.push(originCubeDefinition.qDimensions[1]);
Expand All @@ -35,50 +30,45 @@ async function buildDataCube(
return cubeMatrix;
}

export async function initializeDataCube(component, layout) {
export async function initializeDataCube (component, layout) {

if (component.backendApi.isSnapshot) {
return layout.snapshotData.dataCube;
}
const app = qlik.currApp(component);
const properties = await component.backendApi.getProperties();
const properties = (await component.backendApi.getProperties());
const rowCount = component.backendApi.getRowCount();
const cellCount = rowCount * layout.qHyperCube.qSize.qcx;
const maxLoops = layout.maxloops;

// If this is a master object, fetch the hyperCubeDef of the original object
let hyperCubeDef = properties.qExtendsId
? (await app.getObjectProperties(properties.qExtendsId)).properties
.qHyperCubeDef
? (await app.getObjectProperties(properties.qExtendsId)).properties.qHyperCubeDef
: properties.qHyperCubeDef;
hyperCubeDef = JSON.parse(JSON.stringify(hyperCubeDef));
hyperCubeDef.qStateName = layout.qStateName;
const pagedCube = {};
let lastRow = 0;
if (cellCount < maxLoops * 10000) {
if (cellCount < (maxLoops * 10000)) {
for (let index = 0; cellCount > lastRow; index += 1) {
const requestPage = [
{
qHeight: 1000,
qLeft: 0,
qTop: lastRow,
qWidth: 10, // should be # of columns
},
qWidth: 10 // should be # of columns
}
];
// eslint-disable-next-line no-await-in-loop
pagedCube[index] = await buildDataCube(
hyperCubeDef,
layout.qHyperCube,
app,
requestPage
);
pagedCube[index] = await buildDataCube(hyperCubeDef, layout.qHyperCube, app, requestPage);
lastRow = lastRow + 1000;
}
return pagedCube;
}
return null;
}

export function initializeDesignList(component, layout) {
export function initializeDesignList (component, layout) {
if (component.backendApi.isSnapshot) {
return layout.snapshotData.designList;
}
Expand All @@ -87,11 +77,11 @@ export function initializeDesignList(component, layout) {
return null;
}

return new Promise((resolve) => {
return new Promise(resolve => {
const app = qlik.currApp(component);
const stylingField = app.field(layout.stylingfield);
const listener = function () {
const data = stylingField.rows.map((row) => row.qText);
const data = stylingField.rows.map(row => row.qText);
stylingField.OnData.unbind(listener);
resolve(data);
};
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default {
async getContextMenu (obj, menu) {
const app = qlik.currApp(this);
const isPersonalResult = await app.global.isPersonalMode();
// This check is done because the desktop wrapper blocks downloads.
// This check is done because the desktop wrapper blocks downloads.
// It also blocks this feature in QCS currently as isPersonalMode returns true
if (
!this.$scope.layout.allowexportxls ||
Expand Down

0 comments on commit 3397bd4

Please sign in to comment.