JSFiddle - React, Tailwind, and code Playground
by Kunal Paul
HTML
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-chosen-localytics/1.5.0/angular-chosen.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.6.2/chosen.jquery.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.6.2/chosen.css">
<html ng-app="demoApp">
<div ng-controller="mainController">
<table width="100%" id="userTable">
<tr id="formattyperow">
<td class="label-cell">* Report Format :</td>
<td>
<select name="exporType" id="exporType" ng-model="interactor.parameters.exporType" ng-options="format for format in formatOptions" ng-change="checkDisable();" chosen>
<option value=""></option>
</select>
</td>
</tr>
<tr>
<td class="label-cell">* Mask Account Numbers :</td>
<td>
<select name="maskAccountNumber" id="maskAccountNumber" ng-model="interactor.parameters.maskAccountNumber" style="width:145px;" chosen>
<option value=""></option>
<option value="N">No</option>
<option value="Y" ng-disabled="disableoption">Yes</option>
</select>
</td>
</tr>
</table>
</div>
</html>
JavaScript
angular.module('demoApp', ['localytics.directives'])
.filter('maskAccountFilter',function () {
return function (defaultmaskobject,selectedFormat) {
var i, newObject = [];
for(i=0;i < defaultmaskobject.length;i++)
{
var obj = defaultmaskobject[i];
if(obj["yesNoName"] == "No")
newObject.push(obj);
if(obj["yesNoName"] == "Yes")
{
if(selectedFormat == "XLS" || selectedFormat == "PDF")
newObject.push(obj);
}
}
return newObject;
};
})
.controller('mainController', MainController);
function MainController($scope) {
$scope.disableoption = true;
$scope.formatOptions = ["BAI","CSV","PDF","QBO","QFX","XLS"];
$scope.checkDisable = function() {
console.log("Export type is "+$scope.interactor.parameters.exporType);
if($scope.interactor.parameters.exporType == "PDF")
$scope.disableoption = false;
else
$scope.disableoption = true;
};
};