1 Reply Latest reply on Feb 22, 2012 5:23 PM by Brent Harlow

    How to search on unselected shuttle and not just selected

    Brent Harlow
      Is there a way where I can use the filter by on a parent shuttle to restrict the records shown in the unselected shuttle as well as the selected ?

      Will I be able to accomplish this by creating a custom class that extends JhsSearchBean and applying the same query conditions to the VO populating the unselected shuttle box ?

        • 1. Re: How to search on unselected shuttle and not just selected
          Brent Harlow
          I've managed to get this working by creating my own JhsSearchBean and editing the executeAdvancedSearchBinding method. After the normal search has been done, before returning the result I added the following code (basically copied from the JhsApplicationModuleImpl.advancedSearch method which is being called to run the search on the selected component of the shuttle)

          (this code makes an assumption that only the quick search is being used (single attribute being searched on)
               // Peform search on unselected iterator as well. Get unselected ViewObject
               BindingContext bctx = BindingContext.getCurrent();
               BindingContainer bindings = bctx.getCurrentBindingsEntry();
               DCIteratorBinding unselectedIterBinding = (DCIteratorBinding)bindings.get("EmployeesToBeActivatedShuttleIterator");
               ViewObject unselectedVo = unselectedIterBinding.getViewObject();
               if (arguments == null || arguments.size() == 0) {
                  // clear any previously used view criteria
               else {
                  // Get item being searched on (assumes a single (quick) search item)
                  DCControlBinding binding = ((DCBindingContainer)bindings).findCtrlBinding(searchItem);
                  JUCtrlValueBinding vb = (JUCtrlValueBinding)binding;
                  AttributeDef def = vb.getAttributeDef(0);
                  // Create View Criteria to contain search attribute and value
                  ViewCriteria vc = unselectedVo.createViewCriteria();
                  ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
                  vcRow.setAttribute(def.getName(), searchText);
                  // Requery unselected View Object using search criteria
          After setting the requery condition on both the parent shuttle group and the unselected domain, all seems to be working as expected :)

          Does this seem like an worthy solution ? Or perhaps there is better way ?