sn-record-picker multiselect search not working

Colleen
Tera Expert

I have built a widget that consists of a checkbox list and sn-record-picker.  The sn-record-picker queries the sys_user table and the query changes dynamically based on the selected checkbox list options. Screenshot, HTML and client-side script snippets below.

 

Colleen_0-1694616081363.png

On load, the Staff option is selected by default. and I start typing a valid staff name in the record picker, it returns a correctly filtered staff list. If I also select the Research Students (PGR) option, and start typing a name in the record picker the list is not filtered.  If I deselect Staff, the search works as expected.

 

I have confirmed that the encoded query generated when both checkboxes are selected is correct.  Have I configured the sn-record-picker incorrectly?  There are 23,000+ records that match the default query when both checkboxes are selected, is there a limit on the number of records that the record picker can search?

 

      <div class="checkbox" >
        <label>
          <input type="checkbox" value="staff" ng-checked="c.user_types.indexOf('staff')!=-1" ng-click="updateTypes('staff')"/>
          <span>Staff</span>
        </label>
        <label>
          <input type="checkbox" value="pgr" ng-checked="c.user_types.indexOf('pgr')!=-1"  ng-click="updateTypes('pgr')" />
          <span>Research Students (PGR)</span>
        </label>        
      </div>
    </div>
    <div class="form-group">
      <label for="uob_people_picker" style="font-weight:bold; font-size:115%; margin-bottom: 12px">{{c.data.group.name}} members</label>
      <sn-record-picker multiple="true" id="uob_people_picker" aria-describedby="user_counter"
                        field="c.selected" table="'sys_user'" value-field="'sys_id'" default-query="c.userQuery" page-size="30"
                        display-field="'name'" display-fields="'department,u_user_type'"
                        search-fields="'name'">
      </sn-record-picker>
      <span class="help-block" id="user_counter">{{c.selectedCount}} users selected</span>
    </div>
	var qry = {
		staff: 'active=true^u_user_type=1^u_staff_record_status=LIVE',
		pgr: 'active=true^u_user_type=2^u_student_type=GR^u_registration_status!=L'
	};	
	c.user_types =  (c.options.user_types || 'staff').split(',');
	
	$scope.$watch(
		function() {
			return c.user_types.join(',');		
		},		
		function() {
			c.userQuery = c.user_types.filter(function(elm) { return (elm in qry); }).map(function(elm) {
				var q = qry[elm];
				return q;
			}).join('^NQ');		
			
		}
	);

 

1 REPLY 1

Colleen
Tera Expert

Replying to my own post (sad).

 

The root cause seems to be the sn-record-picker filter function cannot handle compound queries, i.e. multiple queries separated by ^NQ.