We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Reload index before refresh time

Answered
Andrea Fabbri asked on November 18, 2021

Hello,
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();
        flexmonster.updateData({
              type: "api",
              url: reportObj.dataSource.url,
              index: reportObj.dataSource.index
        },
        {
              keepMembersOrder: true,
              ignoreScroll: false
        });
}.bind(this);
But seems don't working, until I use the reload button on the admin panel the data is not updated.
How can I do?
Thanks.
Andrea

3 answers

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster November 20, 2021

Andrea,
 
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

Public
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,
Mykhailo

Public
Andrea Fabbri November 26, 2021

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

Please login or Register to Submit Answer