we are using elasticsearch and want to save/load the state of the grid. Report offers exactly that, however we have a problem:
Our dataSource setup:
This works great on its own. It requests the data at our address ‘https://localhost/some/paths/elastic/index/_mapping’ for the mapping data. Perfect.
Thank you for reporting the problem.
The issue is going to be fixed with a minor update ETA Sep 21.
We will notify you as soon as the version with a fix is available to download.
Also, we want to explain the origin of the problem and propose temporary workarounds.
requestHeaders property of the
dataSource object is not saved with the rest of the report as described in our documentation.
It leads to the difference between the request URL depending on the presence of request headers. For example, in your case, the request URL is “https://localhost/some/paths/elastic/index/_mapping” when request headers are present and “http://elastic/index/_mapping” when they are absent.
After the fix, both cases will be treated equally, leading to the correct output: “https://localhost/some/paths/elastic/index/_mapping“.
As for now, we recommend considering using the full path to the data source.
Another option is to complement the report with request headers before it is passed to Flexmonster. For example, it is possible to manually load the report to the page, add the
requestHeaders property to the
dataSource object, and set the resulting report using the setReport API call.
We hope it works for you.
Please let us know in case other questions arise.
We are happy to let you know that the issue with composing request URL with headers was fixed.
This is available in the 2.8.16 version of Flexmonster: https://www.flexmonster.com/release-notes/.
You are welcome to update the component.
Here is our updating to the latest version tutorial for guidance.
Please contact us in case any questions arise.
Our team is wondering whether the recently provided fix managed to resolve the issue.
We are looking forward to hearing from you.
Oh, I’m sorry. I didn’t know you waited for a reply.
Yes! It works great now. Much appreciated!
As per your update, I tried to save the report having request headers in datasource.
But after saving the report, the downloaded json file doesn’t include the headers, it only includes the api url.
Can you please confirm, how can I achieve this?
I want to pass the large amount of data as param to api url used as datasource. I can’t use the GET api because of size limitation.
Please let me know ASAP.
Thank you for writing to us.
Please note that the request headers not being saved to the report is the expected behavior – this is done for security purposes.
Regarding the second point, based on your question we assume you’re talking about passing particular parameters to your custom data source API instance. If so, we would suggest considering the
cusomizeAPIRequest() API call, which allows you to customize the requests sent to the server for the custom data source API.
This, for example, allows you to set custom request headers containing information about the current user/session, which can then be used on the server to filter the data depending on the user.
Please let us know if this applies to your use case.
Thanks for the fast response.
Is it must to implement APIs at server side for “field, member and select” like CubeController. If yes, is there any other way?
By reading the document it seems that, for every report i need to return the DIFFERENT schema and members from server side.
Please let me know that is my understanding right?
Thank you for your response.
Yes, the custom data source API approach does involve setting up your own endpoints on the server to return only the necessary data parts to the client-side.
If, however, we are not talking about using custom data source API, another viable solution would be to simply load the required parameters to your webpage and store them separately from Flexmonster, passing them to
requestHeaders when necessary. In case the header capacity is not sufficient for all the parameters you need to transfer, feel free to use a custom AJAX POST request to send the parameters in the request body.
Please let us know if this helps.
Hope you’re doing well.
Just checking in to ask if you’ve had a chance to look through our previous response. Have you found it helpful, or is there still anything we can help you with?
We would be happy to hear your feedback.
How are you?
We were wondering if you’ve received our response to your question. Is there still anything we can help you with?
Please let us know your thoughts.
Sorry for the delayed response.
I have tried solution of ajax post request and data is binded to report successfully. But I am stuck while saving this report.
While saving the report, I want to save the ajax api url but instead the data returned from the api response is getting saved.
I referred this example – http://jsfiddle.net/flexmonster/2qb8wzh1/
Can you please help me out to save api url with same solution using JSFiddle or any other solution if any.
It is great to hear from you!
Please note that the Flexmonster report only stores the URL to the JSON file instead of the data itself when you pass the URL to the data source.
In your case, however, you are first loading the data from the URL with AJAX and then passing it to the report, which explains why the whole data set is returned with the report.
At the moment, Flexmonster does not allow changing how this works.
That being said, how critical is it for you to store the URL instead of the data in the report?
Please let us know your thoughts.
Ok, that means I can’t save ajax post api url in this case.
I just want to confirm/know that – Can I pass the large amount params to api url in datasource and SAVE it too wihtout using cusomizeAPIRequest()?
I have already tried these scenarios but didn’t work- 1. get api get fails if parameter data limit exceeds, 2.if I pass them through request headers, they don’t get saved in json file 3.Ajax post request save data insted of api url as want to save api url only.
Or I only have the option to implement cusomizeAPIRequest()?
Thanks & Regards,
Thank you for your swift response.
To clear things up, the mentioned
cusomizeAPIRequest() API call is only applicable when you are using the special custom data source API protocol for your data source. Since you are connecting to a JSON file directly, you won’t need to use this method at all.
Nevertheless, we’ve actually come up with a rather simple solution that allows you to load the data with a POST Ajax request, while also only saving the data URL to the report. Please refer to the following sample for demonstration: http://jsfiddle.net/flexmonster/1jwavbu3/.
This approach starts with the Toolbar customization, with which we modify the “Save” button handler. Instead of the usual
flexmonster.save() API call, the button now triggers a custom function, which retrieves the
report object and replaces its
dataSource content with the required URL value.
Finally, another custom function (found in a Stack Overflow thread) is used to save the newly created report object to a local JSON file.
Please let us know if you find this helpful.