Folks,
I have the following flexmonster object:
var pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "./js/flexmonster/",
report: {
dataSource: {
dataSourceType: "json",
data: {}
},
options: {
configuratorActive: false,
viewType: "grid",
grid: {
type: "flat",
showTotals: "off",
showGrandTotals: "off"
}
}
},
width: "100%",
height: "100%",
toolbar: true,
licenseKey: "XXX",
beforetoolbarcreated: customizeToolbar
});
And the following method that sets some content into the object:
function flexmonsterSetURL( filename ){
console.log( 'FLEXMONSTER-------------start flexmonsterSetURL' );
if (filename != null) {
pivot.updateData({
dataSourceType: "json",
filename: filename
});
pivot.refresh();
}
console.log( 'FLEXMONSTER-------------finished flexmonsterSetURL' );
}
The problem I have is the following:
a) When I pass the followin URL to the javscript method, it works: /queryServlet/?queryID=1
b) When I pass the followin URL to the javscript method, it does not work, showing the error present in the attachment named "flexerror1.jpg": ./queryServlet/?queryID=1
c) When I pass the followin URL to the javscript method, it does not work, showing the error present in the attachment named "flexerror2.jpg": /queryServlet/?queryID=1
d) When I pass the followin URL to the javscript method, it does not work, showing the error present in the attachment named "flexerror1.jpg": ./queryServlet/?queryID=1
Bellow some comments (with the letters related to the previous scenarios cases):
a) It works since apparently the final URL that is used is this one, and no application name is used: http://localhost:8080/queryServlet/?queryID=1
b) As per my understanding, the URL that uses a dot (.) should not have problems, and it seems that the problem is because flexmonster kind of "concatenates" the URL with the "componentFolder" parameter value
c) It does not work apparently because the generated URL is the following one http://localhost:9080/queryServlet/?queryID=1, where we have the application name missing
b) As per my understanding, the URL that uses a dot (.) should not have problems, and it seems that the problem is because flexmonster kind of "concatenates" the URL with the "componentFolder" parameter value
Please give some advice on what would be the solution that woult fit to both scenarios (with and without application name)
Thanks in advance,
Andre Pinheiro
Forgot to attach the other error printscreen
A small update...
I have managed to make this work in both scenarios using the following relative URL, since it seems (according to one of Ian's answers on this post: https://www.flexmonster.com/question/can-we-directly-pass-configuration-as-string-without-creating-a-file-stream/) that flexmonster uses a relative path based on what is defined in componentFolder:
../../queryServlet/?queryID=1
Based on this, I am a little bit confused about the componentFolder property, since I thought it was only used to point where the flexmonster bits were stored, and I am not able to understand why both properties (filename and componentFolder) are connected.
Thanks in advance
Hello Andre,
Thank you for the detailed explanation.
First of all, I can confirm that using a relative path such as ../../queryServlet/?queryID=1
is a recommended way (and I guess only possible now) for your use case.
As for the componentFolder
, you are right, it is used as a base folder for file paths, excepting the paths that start with /
.
It may sound a bit complicated, but it is a way it works for a long time and we cannot change this.
Also, it seems that the paths that start with ./
use componentFolder
as well and behave the same as without ./
.
It may be convenient to ignore componentFolder
for such paths (same as we do for /
). I will add this feature to our backlog for further discussion with the dev team.
Hope my answer was helpful.
Regards,
Ian
Hello Ian,
thank you very much for the clarification. Just wanted to be sure that we were using an approach that is officialy supported by Flexmonster.
Kindest regards,
Andre Pinheiro
Hello, Andre,
Thank you for your reply.
Here is a link to our changes to relative URLs when migrating to the latest version.
Please let us know if this helps.
Best Regards,
Vera
Thanks, Vera and Flexmonster team!!