"executeQuery" of DataSourceProxy Class has wrong behavior on Browser

3313
4
Jump to solution
11-05-2015 01:01 AM
NoppadonHimananto
New Contributor II

Hi, I make custom widget with Javascript that has simple workflow like below.

1. User select datasouce and field that they want to display

set.png

2. User locate location to draw buffer and query selected DataSource with that buffer's geometry to find feature and list them to table.

Well, It's work fine in desktop Application.

Desktop.png

But when I test it on browser.

I got different results here with the same widget.

It list all feature of selected DataSource to table.

Browser.png

So, I inspect query that fire out.

Params.png

and found that geometry's param was ignore in browser so it return all of feature back.

** I use "executeQuery" method of  DataSourceProxy Class to query instead of QueryTask because I want to query with selected Datasource without fix service URL.

I already attach this widget. You can download and test it with some featureLayer on Dashboard.

Thank you.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
TifPun
by
Occasional Contributor II

Hi Noppadon,

Thanks for sending in the sample. I am able to reproduce this problem using my own data, and it seems to be a bug in our API. I noticed that when this.dataSourceProxy.executeQuery(this.query) is called, the buffer's geometry is already dropped from the params of the request, which possibly explains why all features are returned. I have logged a bug into our system and will work with our developers on this.

As you pointed out in another post in the forum, you can use the QueryTask.execute() method as a workaround. I have tried that by replacing the "this.dataSourceProxy.executeQuery(this.query).then(lang.hitch(this, function(results) {}));" block by the following code block, and the table would be populated correctly in the both desktop and browser platforms

        var url = "<url to your data source>";

        var queryTask = new QueryTask(url, null);

        queryTask.execute(this.query).then(lang.hitch(this, function(results){

          this.createTable(results);

        }));

Tif

View solution in original post

4 Replies
NoppadonHimananto
New Contributor II

can anyone test and confirm this?

Thank you.

0 Kudos
TifPun
by
Occasional Contributor II

Hi Noppadon,

Thanks for sending in the sample. I am able to reproduce this problem using my own data, and it seems to be a bug in our API. I noticed that when this.dataSourceProxy.executeQuery(this.query) is called, the buffer's geometry is already dropped from the params of the request, which possibly explains why all features are returned. I have logged a bug into our system and will work with our developers on this.

As you pointed out in another post in the forum, you can use the QueryTask.execute() method as a workaround. I have tried that by replacing the "this.dataSourceProxy.executeQuery(this.query).then(lang.hitch(this, function(results) {}));" block by the following code block, and the table would be populated correctly in the both desktop and browser platforms

        var url = "<url to your data source>";

        var queryTask = new QueryTask(url, null);

        queryTask.execute(this.query).then(lang.hitch(this, function(results){

          this.createTable(results);

        }));

Tif

NoppadonHimananto
New Contributor II

Hi Tif,

Thanks for letting me know.

0 Kudos
TifPun
by
Occasional Contributor II

Hi again Noppadon,

This bug has been fixed and has passed our testing. The fix will be available in the next release of browser Dashboard.

Please let us know if you have more questions,

Tif

0 Kudos