- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2017 05:33 AM
Hi All,
I want to create two reference fields which depends on other like user and task. When i select user then in task field only tickets raised by him should be visible.
Also, providing a button "Add Row" if user clicks on this then new two fields will come and same dependency should work for this row also.
I am struggling on assigning field value dynamically to observe and get newvalue that was changed. Please help me to solve this issue.
<tr ng-repeat="rowCounter in table_data track by $index" id="tableRow_{{rowCounter.number}}">
<td ng-repeat="columnObj in rowCounter.fields">
<div class="form-group" ng-class="{'has-success' : columnObj.value != ''}">
<span ng-switch="columnObj.type">
<span ng-switch-when="reference">
<sn-record-picker field="ed_user" table="columnObj.table" display-field="columnObj.displayField" value-field="columnObj.valueField" search-fields="columnObj.searchFields" name="columnObj.name" default-query='' page-size="100" ng-if="columnObj.table == 'sys_user'" id="user" on-change="c.getLaptopDetails(table)"></sn-record-picker>
<sn-record-picker field="columnObj.value" table="columnObj.table" display-field="columnObj.displayField" value-field="columnObj.valueField" search-fields="columnObj.searchFields" name="columnObj.name" default-query="'assigned_to='+user" page-size="100" ng-if="columnObj.table != 'sys_user'"></sn-record-picker>
</span>
<span ng-switch-when="number">
<input type="number" ng-class="{'form-control-success':columnObj.value > 0}" max="{{columnObj.max}}" min="{{columnObj.min}}" class="form-control" ng-model="columnObj.value" />
</span>
<span ng-switch-when="checkbox">
<input type="checkbox" ng-class="{'form-control-success':columnObj.value > 0}" max="{{columnObj.max}}" min="{{columnObj.min}}" class="form-control checkbox" ng-model="columnObj.value" />
</span>
<span ng-switch-default="">
<input type="text" ng-class="{'form-control-success':columnObj.value != ''}" class="form-control" ng-model="columnObj.value" />
</span>
</span>
</div>
</td>
Client Controller:
$scope.ed_user ={
name: 'approver'
}
$scope.$on("field.change", function(evt, parms) {
if (parms.field.name == 'approver'){
alert(parms.newValue);
$scope.user = parms.newValue;
}
});
laurentchicoinechiragbagdaichiragb
lchicoineThanks in advance.
Regards
Swamy
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 04:45 PM
Not sure what you mean by a html variable, you mean a html table?
In the demo widget I made you could display it directly using the $scope.columns array.
Here is the updated HTML code for that example:
<div ng-repeat="column in columns">
<sn-record-picker field="column.field" table="'sys_user'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100"></sn-record-picker>
<sn-record-picker field="column.field2" table="'task'" display-field="'number'" value-field="'sys_id'" search-fields="'short_description'" default-query="column.queryField2" page-size="100"></sn-record-picker>
</div>
<button ng-click="addRow()">
Add row
</button>
<table border="1">
<tr>
<th>User</th>
<th>Task</th>
</tr>
<tr ng-repeat="column in columns">
<td>{{column.field.displayValue}}</td>
<td>{{column.field2.displayValue}}</td>
</tr>
</table>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 08:18 PM
Thanks a ton.
Actually, I knew that there should be a prototype and class declaration in a script include. I had no knowledge about " server side script running with the user's ACL in sandbox mode" concept. So thanks for sharing. I will keep in contact with you for further knowledge sharing.
Thanks,
Saptashwa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 10:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2017 07:12 AM
Hi Saptashwa,
It's really great to see your preview which I am searching for a long time. Could you please share your full html, client & server scripts for the above example which will be very helpful for me.
Thanks in advance