Select to view content in your preferred language

Select with feature layer using buffer and send selected features to a datagrid

2949
7
Jump to solution
08-20-2014 01:46 PM
JssrRR
by
Frequent Contributor

Hi,

I need some help on this, I am trying to use a circle to buffer a feature and select all features that fall within that buffered distance, that part is working fine, but when I try to send the selected features to a datagrid, nothing works.

Here is what I have so far, please see attached .txt file for code.

If I can get some help to figure out what I am missing or fix errors that I am not able to detect, it will be great.

Any help will be appreciated, Thanks..

0 Kudos
1 Solution

Accepted Solutions
RiyasDeen
Frequent Contributor

Hi Saloni,

Modified your code to make it work.

Edit fiddle - JSFiddle

View solution in original post

7 Replies
RiyasDeen
Frequent Contributor

Hi Saloni,

Modified your code to make it work.

Edit fiddle - JSFiddle

JssrRR
by
Frequent Contributor

Thanks a lot, Riyas. It is working now, great!!

Noticed what I was missing and saw the changes you made.

Thanks for the help.

0 Kudos
JssrRR
by
Frequent Contributor

Riyas,

You had helped me a couple of weeks back with my JavaScript application, I am now trying to add some more functionality to this application, I want to add print and export to csv functions to the datagrid.

I was going through the documentation for Dgrid for options

dgrid - A Dojo grid created by SitePen

and noticed that it does not have print and export features, but from what I have been reading through forums and other places, I see suggestions for

using plugins for printer and exporter which only work with EnhancedGrid

dojox.grid.EnhancedGrid.plugins.Printer — The Dojo Toolkit - Reference Guide

dojox.grid.EnhancedGrid.plugins.Exporter — The Dojo Toolkit - Reference Guide

Example:

http://datatables.net/extensions/tabletools/

I did not find any samples in ArcGIS JavaScript Api reference that use Enhanced grid, do you have any suggestions how I can go about adding Print and Export to csv or excel, in this example that I have attached here.

Thanks in advance!

0 Kudos
RiyasDeen
Frequent Contributor

Hi Saloni,

I have updated the fiddle to use Enhanced grid, this should get you started.

Edit fiddle - JSFiddle

JssrRR
by
Frequent Contributor

Hi Riyas,

Thank you very much for updating the code to use Enhanced grid, the print function works well, but for some reasons it works only once and does not update and if we click on another point, the map disappears and does not load again, I am trying this in JSFiddle, if you can take a look that it will be great.

Also, export all to csv, just gives an alert message, I want to be able to save or download that, is there any way to do that. I came across some examples that use Iframe something like this,

dojo/request/iframe view /dojo/request/iframe

require(["dojo/request/iframe"], function(iframe){

  iframe("csv", {

  handleAs: "csv"

Found one that has something similar,

http://jsfiddle.net/g42qpc75/4/

but since I am new to JScript, I do not know if that will solve the issue or help in my example.

Thanks again for your time and help!

0 Kudos
RiyasDeen
Frequent Contributor

Hi Saloni,

Rgd. the print functionality, it tested my fiddle in IE and chrome and works just fine, it's bringing up the print dialog as many times i try.

Export to CSV, you'll need a server side component which will stream the csv format returned by exportGrid function (where I'm issuing the alert) back to the client with download dialog. Check out this thread javascript - Exporting a dojo datagrid to a csv file - Stack Overflow . You can use IHttpHandler for .Net, there is a workable sample for PHP in the above thread.

Don't ask me how it can be done using java, answer will be i dono.

JssrRR
by
Frequent Contributor

Riyas,

It does work now, I am not sure what I was doing wrong earlier. Thanks for explaining the server side component for export/download to CSV, I kind of had an idea, I now understand it better. The link to the thread that you have sited in your answer is the same one I got the iframe/export handler example.

Thanks for all the help.

0 Kudos