how to dynamically change filter based on another filter in widgets using SN_RECORD_PICKER

IndhumathiK
Tera Contributor

Hi,

I'm new to widget. I want to create two filters, the condition for this that when a group is selected the corresponding value should shown in the LAB Name field. I have done this using SN_RECORD_PICKER, but can't able to achieve this. Can anybody help me with this?

 

PREVIEW:IndhumathiK_0-1740735523186.png

SERVER:

data.lab_req_query = 'technologySTARTSWITH';

CLIENT:

	$scope.technology = {
		displayValue: $scope.data.technology,
		value: $scope.data.technology,
		name: 'technology'
	};
	$scope.lab_name = {
		displayValue: $scope.data.lab_name,
		value: $scope.data.lab_name,
		name: 'lab_name'
	};
	$scope.$on('record.updated', function(name, data) {
		spUtil.update($scope);
	})

HTML:

<div class="col-xs-2">   
    <label for="group" style="display: block; text-align: left;">GROUP</label>
    <select ng-model="selectedOption" ng-change="level1()" id="group" style="height: 30px;" name="group1">
      <label for="group">GROUP</label>
      <option value = "Apps">Apps</option>
      <option value = "Backup">Backup</option>
      <option value = "Databases">Databases</option>
      <option value = "Unix">Unix</option>
      <option value = "	Portal Support">Portal Support</option>
      <option value = "Windows">Windows</option>
    </select>
  </div>
  <div ng-if="data.lab_req_query.length > 0" class="col-xs-3" style="margin-bottom: 10px;">
    <label for="lab">LAB NAME</label>
    <sn-record-picker style="width: 100%;"
                      placeholder="Lab Name"
                      id="lab"
                      field="lab_name"
                      table="'x_sitl_goinfinit_lab'"
                      default-query="data.lab_req_query"
                      display-field="'lab_name'"
                      value-field="'sys_id'"
                      search-fields="'lab_name'">
    </sn-record-picker>
    {{ data.lab_req_query }}
  </div>

 

1 REPLY 1

Kieran Anson
Kilo Patron

I believe you should be able to specify the following in your client controller and AngularJS digest cycle should auto update the filter 

 

data.lab_req_query = 'technologySTARTSWITH' + c.selectedOption