Currently we use the following sequence to load Pivot.
While doing this at the first call after setReport() we see this error:
flexmonster.js:9 Uncaught TypeError: Cannot read property 'pages' of undefined
at L7.select (flexmonster.js:9)
at L7.filter (flexmonster.js:9)
at k4.refresh (flexmonster.js:9)
at a.Rt (flexmonster.js:9)
at a.k1.uG (flexmonster.js:9)
at flexmonster.js:9
We are using the 2.4.x version. Any immediate help would be highly appreciated.
Hello Sujit,
Thank you for your question. Please note that when you want to use a sequence of Flexmonster's methods you need to be sure that the structure is loaded and the component is ready to answer the requests. In such case, we recommend using Flexmonster's events such as "reportcomplete". This event means that the component is initialized and ready to perform other operations. Here is the example of how to use "ready" event: https://www.flexmonster.com/doc/using-methods-and-events-angular/#subscribe-via-on-method. In your case the handler will look the following way:
function onReportComplete() {
flexmonster.off("reportcomplete");
flexmonster.on("reportcomplete", function() { flexmonster.off("reportcomplete");
flexmonster.on("reportcomplete", function() {
flexmonster.off("reportcomplete");
flexmonster.getData(...); // getting the data
})
flexmonster.setSlice({...}); //setting slice
});
flexmonster.setReport({...}); // setting report
}
The code above describes the general idea and can be optimized. Please find more information about on() and off() methods here: https://www.flexmonster.com/api/on/, https://www.flexmonster.com/api/off/. Also, we recommend considering the idea of combining the steps for pivot loading in one step since it looks a little bit excessive.
Please let us know if it solves the case.
Regards,
Dmytro
Is there a setSlice() method as you mentioned above. This will come very handy as we are trying to do the following:
However, the setSlice() seems to be a non-supported method. What would be the best way to set a lice before setting the filters - and without using setReport().
Hello, Sujit,
Thank you for your reply.
We can suggest you runQuery()
method which allows setting the custom slice. For more details and example please refer to our docs: runQuery.
Please let me know if you have other questions.
Regards,
Tanya