0
我創建了一個plunker顯示問題hereAngularJS - 有條件的邏輯不會重新顯示
如果你點擊「缺失數據顯示行」的鏈接點擊原始數據鏈接,然後一切都很好,它過濾顯示行數據錯誤。但是,如果你點擊「顯示所有數據」,它將不會再顯示其餘的數據?如何解決這個問題?
代碼:
vm.applyMissingValuesFilter = function (linktext) {
if (linktext === "Display rows with missing data") {
vm.savedResourceGridResources = vm.resourceGridResources;
var results = [];
var temp = vm.resourceGridResources.Resources;
for (var i = 0; i < temp.length; i++) {
for (var j = 0; j < temp[i].Resources.length; j++) {
if (!temp[i].Resources[j].Value) {
if (results.indexOf(temp[i]) === -1) {
results.push(temp[i]);
}
}
}
}
vm.resourceGridResources.Resources = results;
vm.missingValuesButtonText = "Show all data";
}
else if (linktext === "Show all data") {
// should reset the resource values here to redisplay original data?
vm.resourceGridResources = vm.savedResourceGridResources;
vm.missingValuesButtonText = "Display rows with missing data";
}
};