Get Free Trial

Reload index before refresh time

Andrea Fabbri asked on November 18, 2021

I have a costum button inside the toolbar which have to reload data from the db before the refresh time expire. I tried with the updateData function (here is the code)
let myRefreshHandler= function() {
        let reportObj = flexmonster.getReport();
              type: “api”,
              url: reportObj.dataSource.url,
              index: reportObj.dataSource.index
              keepMembersOrder: true,
              ignoreScroll: false
But seems don’t working, until I use the reload button on the admin panel the data is not updated.
How can I do?

3 answers

Mykhailo Halaida Mykhailo Halaida Flexmonster November 20, 2021

Thank you for raising your support ticket.
When using Flexmonster Data Server, calling the updateData() API call does not trigger any database data reloading, it simply specifies which Data Server instance data should be pulled from. 
To actually reload the data from the database, you need to refresh the index on the side of the Data Server, which is what you’ve mentioned doing through the Admin Panel. There is also a way to do that programmatically via an API endpoint. This approach requires using Flexmonster Data Server as a service.
When used as a Unix/Windows service, Flexmonster Data Server provides an API endpoint on port 9555 for reloading indexes. Please note that the API accepts requests only from the same machine where the Flexmonster Data Server service is installed.
With this approach, you could reload indexes by sending the following PUT request “http://localhost:9555/admin/indexes/reload/YOUR_INDEX_NAME“.
Please let us know if this helps.
Best regards,

Mykhailo Halaida Mykhailo Halaida Flexmonster November 25, 2021

Hi Andrea,
How are you?
Just checking in to ask if you’ve found my response helpful. Does the described approach work for you?
We’d be happy to hear your feedback.
Best regards,

Andrea Fabbri November 26, 2021

Hi Mykhailo,
thank you for the response your approach was very usefull and it worked for me.

Please login or Register to Submit Answer