Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have some trouble with creating table in Qlik Sense extension.
If I wrote:
let object = app.createTable(dimensions,{rows:1000});
console.log('object: ', object);
Promise.all([object]).then(function(values){
console.log('rows: ', object.rows);
console.log('qHyperCube: ', object.qHyperCube);
});
I get
Witch I don't understand:
- we can see that when I print whole object I can see rows (and they are right) and qHyperCube witch has same rows inside.
- But when I wan't to extract this information I get empty array/undefined object
- I understand that createTable only return promise,....
How do you do this?
Marko Zadravec
Hi,
You need to wait for the OnData event before the rows are actually available.
The fact that you see them in the console is because Chrome doesnt check inside the object until you click on the arrow, at which time the data will be available.
Hope this helps
Erik Wetterberg
Hi,
You need to wait for the OnData event before the rows are actually available.
The fact that you see them in the console is because Chrome doesnt check inside the object until you click on the arrow, at which time the data will be available.
Hope this helps
Erik Wetterberg
Yes this is true,
I figure out that I need to bind observer to table, to check when data come.
I don't know why, but Promise.all doesn't work.
Promise.all does work, but the promise resolves when the table object is available, which is earlier than it has data, the framework needs to call getLayout to get the data.
Erik Wetterberg
How did you bind observer to table? I tried using below code but it is not working:
var table = qlik.table( this ); var listener = function() { var rowCount = table.rowCount; var colCount = table.colCount; table.OnData.unbind( listener ); //unregister the listener when no longer notification is needed. }; table.OnData.bind( listener ); //bind the listener