I am migrating my Flex eSearch widget to the CMV Search widget. I need to be able to pass a query through an url within the widget. Currently my widget has 8 URLs that are in the widget.
Flex Code:

You didn't include the Flex code. I assume you are asking about my Search widget Below is what I do to run a query from the url with my widget.

You need to include some additional modules at the top of your viewer.js file:

define([
    ...
    'dojo/io-query',
    'dojo/topic'

], function (... ioQuery, topic) {

Include this queryString widget in the widgets section of viewer.js:

queryString: {
    include: true,
    id: 'queryString',
    type: 'invisible',
    path: 'dijit/_WidgetBase',
    options: {
        startup: function () {
            var uri = window.location.href;
            var qs = uri.substring(uri.indexOf('?') + 1, uri.length);
            var qsObj = ioQuery.queryToObject(qs);
            var id = qsObj.ID;
            if (id) {
                window.setTimeout(function () {
                    topic.publish('searchResults/search', {
                        layerIndex: 0,
                        searchTerm: id
                    })
                }, 2000);
            }
        }
    }
}

Note at present, searching from the url is limited to a single search term (1 field).

  • Yes, I am talking about your search widget. Here is the Flex code. I have 10 URL (sorry not 8) strings that are pointing to the same field. I included one example. </link> <link alias="Windyty Wind Map Forecasts" disablelinksifnull="true" disableinpopups="false" popuplinktype="text"> <![CDATA[windyty.com{ICAOcode}]]><icon><![CDATA[assets/images/i_pws.png]]></icon> </link> How should I add the query in the config/searchWidget.js file? – cmccullough Apr 28 '16 at 22:28
  • Should these be the same? io-query and ioQuery. I am new to this configuration. Thank you for your help. – cmccullough Apr 28 '16 at 22:35
  • If my answer did not provide enough information to resolve your question, can you provide the format of the url including the query string you are using. I can edit my answer to use the specific parameters/values you use. – tmcgee Apr 29 '16 at 15:10

I found a simple answer to my question. I just added an additional tag for each URL. I used the same url in the example for simplicity sake. Windyty Wind Map Forecasts
Windyty Wind Map Forecasts
Windyty Wind Map Forecasts
Windyty Wind Map Forecasts
Windyty Wind Map Forecasts
Windyty Wind Map Forecasts
'

I figured the ioQuery question. The function did not like the "-" in the text.

  • 2
    Perhaps you can edit your answer to include details on how you figured it out? =) – Joseph Apr 29 '16 at 14:04
  • Also, you should merge your user accounts into a single account. – Evil Genius Apr 29 '16 at 14:25
  • I only have one account – cmccullough Apr 29 '16 at 14:28
  • 1
    I figured out what I did and have submitted the request to merge the two accounts into cmccullough2 – cmccullough Apr 29 '16 at 14:35

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.