All checkboxes in the list is getting checked for maybe wrong value passing in ng-model
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 02:38 AM
I have a requirement to create a custom widget for showing all case records and each case will be attached to a checkbox. So, whenever the checkbox is checked, the case item need to be pushed to an array.
Now, as for populating the case records I used ng-repeat, so even if i am checking on checkbox it is automatically checking all the items in the list. For the below portal snapshot, i just clicked on 1 case and system checked rest 2 automatically. which should not happen.
Assumption :This might be causing for the data passed in ng-model=c.data.item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 04:21 AM
Hi Prity,
Keep ng-model
In client script you have configured many alerts, which one is not showing ?
I feel there is error in the below line
if (c.data.item == true)
replace this with
if (c.data.item != "")
As c.data.item is an array it will not contain value true or false
Also while popping alert spelling is misspelt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 02:50 AM
HTML Part
<table ng-if="data.items.length" class="grid-table" class="tableContent">
<thead>
<tr>
<td><input type="checkbox" id="selectAll" value="selectAll"></td>
<th ng-repeat="field in ::data.row">{{field}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in data.cases.list">
<td><input type="checkbox" id="{{::item.number}}" value="{{::item.number}}" name="{{::item.number}}" ng-model="c.data.item" ng-change="c.toggle({{item}})"></td>
<td role="cell" ng-repeat="field in ::data.row">{{item[field]}}</td>
</tr>
</tbody>
</table>