suman goud

suman goud

  • NA
  • 176
  • 50.9k

How to give condition to dropdown on adding new row

Sep 17 2016 12:51 AM
i have a table with dropdown and other controls
am adding new row on drop down change using angular js
 
 
<table id="myTable" class="tableData" border="0" cellpadding="0" cellspacing="0">
<tr>
<th>Customer</th>
<th>Pendings</th>
<th>Pending Value</th>
</tr>
<tr ng-repeat="r in rvm" @*ng- ng-class-odd="'odd'" ng-class-even="'even'"*@>
<td>
<select ng-model="ID" ng-change="GetAccountBalance()" style="width:150px;height:22px;" name=" tCustomer">
<option value="0">Select Customer</option>
<option value="1"> A</option>
</select>
</td>
<td>
<button type="button" class=" btn-sm" data-toggle="modal" ng-click="GetPendings(ReceiptsViewModel)" data-target="#ShowPendings">Pendings</button>
</td>
<td>
<span id="spAmount">{{ReceiptsViewModel.PendingAmount}}</span>
</td>
</tr>
</table>
 
angular code to add new row
 
var ReceiptsApp = angular.module('ReceiptsApp', []);
ReceiptsApp.controller('ReceiptsController', function ($scope) {
$scope.rvm = [{}];
$scope.GetAccountBalance = function () {
$scope.rvm.push({
});
}
});
 
but my requirement is,
if i select dropdown am adding new row that is fine,
but am changing value first dropdown again,it is adding one more row.
but i want like if i select first dropdown add row, then add new row on selecting dropdown in second row
now dont add rows on change of first and 2nd row dropdown 

Answers (6)