• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Passing a filter from a map widget to a grid widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Passing a filter from a map widget to a grid widget

    Hi,

    I have a map widget that shows a grid widget aside once a Map Marker gets clicked. That works fine, the data is filtered nicely based on the Marker clicked.
    But the Map Widget also has a filter defined, that filters the map nicely also. But I can't get it to filter the grid widget alongside.

    In the Nitro app I added an app variable in the Map widget to the 'Set Filters'
    In the behaviours I defined on the Marker Click action a Filter widget of the grid filter based on the app variable.

    The grid is show based on the Marker clicked but it doesn't use the filter set in the Map widget.

    Any help would be appreciated.

    Theo

  • #2
    Hi Theo,

    So you have filter(s) defined directly on the map widget that you want to also be applied to the grid widget?

    Could you supply a screenshot of the running application?

    Comment


    • #3
      Hi Johnny

      Yes, thats right. See attachments for screen shots
      Attached Files

      Comment


      • #4
        We recommend a form widget be used if you want to filter more than one widget since the filters directly on a widget are meant for just that widget

        However if you wanted to filter another widget based on widgets filter(s) you could do that by
        • Create an app variable to hold your filter value
        • Create a event that will filter your grid based on the app variable created
        • Create a filter program for your map that will
          • Get the value of the filter
          • Set the value of your app variable to the value of the filter
          • Fire the event that will filter your grid
        Very quick example of a map with a country filter that filters the grid in the same section

        NAB - Forum App Variable.png

        NAB - Forum Event Listener.png

        NAB - Forum Filter Widget RPG.png

        NAB Forum - App.png

        Comment


        • #5
          Hi Johnny,

          Thanks a lot. I managed to get it to work almost perfect. The grid is showing the correct data and header based on None, 1 or both filters (Map filter and Marker clicked) defined on the Map widget.

          The only thing missing here is that I can't get control on the reset filter action on the Map widget. I tried both the Filter and the Initial value program on the Map widget but they ain't called on the reset action. Therefore my App vars ain't reset also.

          Is there any way to solve this?

          Kind regards,
          Theo

          Comment


          • #6
            Hi Theo,

            Unfortunately there's no easy way to hook into the reset of a widget's filters. I would suggest creating a form that filters your widgets and has a reset button.

            However you could execute a script on startup via behaviors..

            Here I named my map that has the filters "customerMap", then I am listening for the click event on the reset button, clearing my app variables and firing my event of "filterList"

            Code:
            var map         = getWidget('customerMap'),
                resetButton = map.down('button[text=Reset]');
            
            if (resetButton) {
                resetButton.on({
                    click: function (btn) {
                        setAppVar('mapCity', null);
                        setAppVar('mapCountry', null);
                        Runner.getApplication().fireEvent('filterList');
                    }
                });
            }
            Last edited by robert.swanson; 01-28-2023, 04:53 PM.

            Comment


            • #7
              Hi Johnny, It's all working fine now, Thanks for your help

              Comment

              Working...
              X