Skip to content

Commit

Permalink
fix: 修正僅顯示平均成績在搜尋列清空時效果錯誤的bug
Browse files Browse the repository at this point in the history
原本使用onchange做dom控制
現改成使用ngjs的object儲存狀態
於tr用ng-show控制dom顯示
  • Loading branch information
Chinlinlee committed Jan 31, 2021
1 parent 35101b2 commit 1edeeba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions views/atm/History_Scores.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@

<button id={{item.Sem}} class="btn btn-primary btn-lg darkmode-ignore" style="width:100%;isolation: isolate;" onclick="Item_Visible_Control('HStable_' + this.id)">{{item.Sem}}學年度(點我開啟or隱藏))</button>
<div id="HStable_{{item.Sem}}" class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" onchange="Item_Visible_Control('HStr_' +this.name)" id="custoncb_{{item.Sem}}" name="{{item.Sem}}">
<label class="custom-control-label" for="custoncb_{{item.Sem}}">僅顯示平均成績</label>
<input type="checkbox" class="custom-control-input" id="custoncb_{{item.Sem}}" name="{{item.Sem}}" ng-model="isOnlyAvgScore[item.Sem]">
<label class="custom-control-label" for="custoncb_{{item.Sem}}" >僅顯示平均成績</label>
</div>
<div dw-loading="DataList" dw-loading-options="{text: '載入清單...'}">
<table id="HStable_{{item.Sem}}" class="table table-bordered table-striped table-rwd">
Expand All @@ -78,7 +78,7 @@
</tr>
</thead>
<tbody>
<tr name="DataList" ng-repeat="hs in DataList |orderBy :'-Up_Score' | filter:q as results track by hs.Course " ng-if="hs.Sem ==item.Sem" id="HStr_{{item.Sem}}}}">
<tr name="DataList" ng-repeat="hs in DataList |orderBy :'-Up_Score' | filter:q as results track by hs.Course" ng-if="hs.Sem ==item.Sem" id="HStr_{{item.Sem}}}}" ng-show="!isOnlyAvgScore[item.Sem]">
<td data-th="學年" id="{{hs.Sem}}" >{{hs.Sem}}{{item.$index}}</td>
<td data-th="課別" id="{{hs.Sem}}_content_type">{{hs.Type}}</td>
<td data-th="課程代碼與課程名稱" id="{{hs.Sem}}_content_course">{{hs.Course}}</td>
Expand Down
6 changes: 6 additions & 0 deletions views/atm/scripts/History_Scores.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ HSApp.controller("HSCtrl" , function($scope , HSService , commonService)
$scope.DataList = [];
$scope.Conlist = [];
$scope.Sems = [];
$scope.isOnlyAvgScore = {

}
$scope.Currentuser = "";
commonService.user.getStuInfo().then(function (res) {
$scope.Currentuser = res.data;
Expand Down Expand Up @@ -36,6 +39,9 @@ HSApp.controller("HSCtrl" , function($scope , HSService , commonService)
$scope.Conlist = HS_con;
var Sems = res.data[2];
$scope.Sems = Sems;
for (let sem of $scope.Sems) {
$scope.isOnlyAvgScore[sem] = false;
}
let checkDOMExist = setInterval(function () {
if ($("table").length > 0 ) {
console.log('yes');
Expand Down

0 comments on commit 1edeeba

Please sign in to comment.