Select to view content in your preferred language

Enhanced Search Widget for FlexViewer 2.1

105161
767
10-25-2010 02:13 PM
RobertScheitlin__GISP
MVP Emeritus
All Here is my next widget in the FlexViewer 2.1 series

Special thanks to Erwan Caradec for contributing to this code.

The Enhanced Search Widget extends the standard search widget with a floating data grid and a new spatial query w/buffering.

http://www.arcgis.com/home/item.html?id=5d4995ccdb99429185dfd8d8fb2a513e
Tags (2)
0 Kudos
767 Replies
RobertScheitlin__GISP
MVP Emeritus
All,

   Version 2.4 for FlexViewer 2.4 is now released.

* Both the compiled and uncompiled version can use the URL Search capability.
No code changes needed!
    See the Enhanced Search Widget URL Search Configuration.pdf

  * Links in the results, popUp and Data grid now do not display a link if the link field contains
    a Null or empty string.
  * Fixed error when clearing the graphics results and using the fixed data grid.
  * Fixed issue with buffer point widget button displaying as enabled after you hover over it, even
    though it is not enabled.
0 Kudos
IrfanClemson
Occasional Contributor II
Robert,
I have downloaded the latest Enhanced Search Widget a couple of days ago and it works fine. Our code base is still pre-Flex Viewer 2.4. I am not sure we should over-write the code base without having to overwrite some of the custom .mxml changes we have done.
With that said, we need to have the Grid to not show any links if the data is null. Now, I have deployed the latest Enhanced Search Widget to the pre SFV 2.4 code base but we still have the problem of Grid showing the links even if there are null values.
For example:
<field name="LEASES" alias="Leases" hyperlinkgridfield="true" hyperlinkaliastext="View Leases" linkprefix="http://pathtotheserver/" linksuffix="" gridfieldonly="false"/>

I suspect it is the linkprefix which is making even null values to appear non-null in the Grid?
Any idea as to how to fix that?
Thanks!
0 Kudos
IrfanClemson
Occasional Contributor II
I think around line #620 of the SearchWidgetDGFloat.mxml there is the code which needs to be modified to disable links for null values.

if(attributes[hypercols.field] != "" && attributes[hypercols.field] != " "){
var pre:String = (hypercols.pre == "NA") ? "" : hypercols.pre;
var suf:String = (hypercols.suf == "NA") ? "" : hypercols.suf;
attributes[hypercols.field] = String(pre + attributes[hypercols.field] + suf);
}

0 Kudos
IrfanClemson
Occasional Contributor II
Never mind. I think I have this problem fixed by modifying the above code a bit:

if (attributes[hypercols.field]) {
        if (attributes[hypercols.valueOf()] != null) {
        attributes[hypercols.field] = String(pre + attributes[hypercols.field] + suf);
        }
       }
       else {
        attributes[hypercols.field] = "";
       }

0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Meengla,

   I don't think your code is working as you are expecting it is. I was searching for a blank string or empty string but you were right I was not handling a null value. Here is the code to handle all of those:

                        if(attributes[hypercols.field] != "" && attributes[hypercols.field] != " " && attributes[hypercols.field] != null){
                            var pre:String = (hypercols.pre == "NA") ? "" : hypercols.pre;
                            var suf:String = (hypercols.suf == "NA") ? "" : hypercols.suf;
                            attributes[hypercols.field] = String(pre + attributes[hypercols.field] + suf);
                        }
This code will be is the next hot-fix release.

Thanks for the bug report.
0 Kudos
IrfanClemson
Occasional Contributor II
Robert,
Thanks for your help. But I think the fix I applied in my code below handles 'null' just fine.
Great widget, btw!
Meengla
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Meengla,

   Glad you have it working. Just so you should know this line of code is not a valid check for the value of the hyperlink column being null after the first iteration through the loop:

attributes[hypercols.valueOf()] != null
Basically you are getting the value of the object in the hypercols array collection at i, and it will always be an object.

hypercols.addItem({field: cArr[0], name: cArr[1], alias: cArr[2], pre: cArr[3], suf: cArr[4]});
0 Kudos
IrfanClemson
Occasional Contributor II
Robert, I had already tried the following line:

if(attributes[hypercols.field] != "" && attributes[hypercols.field] != " " && attributes[hypercols.field] != null){

but found out that null values were indeed passing through (meaning, not caught in the 'IF' statement); and then I sometime saw error about 'reference to null' object which meant that attributes[hypercols.field object was null when I tried to gets its 'valueOf()' property. And hence I ended up with my code above. So far I don't see any problem with my code: All null values are caught now and don't show up in the grid.

Thanks for your help again.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Meengla,

   I want to be sure that I get this fixed properly for my next release, so If you don't mind I have some more questions. Can you share your SearchWidget.xml so I can attempt to understand why you sometime saw an error about 'reference to null'. I have been able to trap null values and empty strings and " " strings using the code I posted. So I am curious why it is not working for you, what is the difference between my tests and what you are testing is what I want to understand. If you don't have any more time to spend on this I understand.
0 Kudos
IrfanClemson
Occasional Contributor II
Robert,
Sure. I can send away my SearchWidget.xml file right away--but it will have to be private. So please figure out a way to share that file? May be you can send me a private message with your email in it?
Sorry for the hassle.
Thanks,
Meengla
0 Kudos