• 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.

Show and filter specific widgets based on data in another widget

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

  • Show and filter specific widgets based on data in another widget

    I have a situation where I would like to display a grid widget associated with a particular type of data but I don't know what that type is until the user selects a particular row in an existing grid. Once they select a row, I want to show and filter a widgets based on the value of a field in the source row.

    For instance, if the row has a field named MYTYPE and the value is 'A', I want to open and filter GridA based on the values of the other fields in the source record.

    Now the user selects a different row where the MYTYPE field has a value of 'B'. I then want to open and filter GridB also based on the values of other fields in this new source record.

    The data in GridA and GridB come from two separate data sources and are not something I could easily combine into a single SQL union query. I figure there has to be a way to do this using Execute Scripts but I have a hard time tracking down the specific calls I'd need to make in the Javascript setting.

  • #2
    This is an ideal scenario to use event listeners. Try the following steps:
    • Go into the behaviors section of your application and locate the Event Listeners section.
    • Click the Add Event Listener menu option.
    • In this case, we will be firing back end events so click the Back-End Event text/button.
    • Enter the name of the event. For this example, I will call it "mytype_a".
    • Add the necessary actions (filter widget, hide/show widgets, etc...) beneath this event listener. These actions will be executed when the row clicked has a value of "A" for the MYTYPE field.
    • Next, repeat the same steps for an event named "mytype_b".
    • Add a row click action of "Call RPG Program" to your grid. This program will be based off of the EXNABBTN template. (see code below).
    Code:
    lMyType = GetSelectionChar(1:'MYTYPE');   
    if lMyType = 'A';
      SetResponse('fireEvent':'mytype_a');
     elseif lMyType = 'B';
      SetResponse('fireEvent':'mytype_b');
    endif;
    SetResponse('success':'true');

    Comment


    • #3
      As a followup to this, I want to filter the newly shown widget based on separate fields from the original widgets. Is there a way to maintain that link or do I need to resort to passing this information through app variables from the backend button handler that fires off the events?

      Comment


      • #4
        You have 2 options:

        1. Have the back-end set this (as you mentioned).
        2. Add a "Set App Variables" action before your Call RPG Program. Here you would have access to the row that was clicked and can set the app variables.

        Comment

        Working...
        X