Расширяемые и свертываемые строки в AngularC#

Место общения программистов C#
Anonymous
Расширяемые и свертываемые строки в Angular

Сообщение Anonymous »

Моя основная цель — позволить пользователю расширять строку дочерними строками, когда он нажимает кнопку внутри строки. Однако со стороны получения данных и со стороны JavaScript все кажется правильным, но по какой-то причине строки не появляются, когда я нажимаю кнопку. Я понятия не имею, что еще делать, поскольку весь день пытался это исправить.
Я перепробовал все, что мог придумать, и все выглядит правильно, я' Надеюсь, вы подскажете мне, в чем может быть проблема.
This is my js:

$scope.toggleStockOrderDetails = function (index) {
// Check if the index is within the bounds of the array
if (index < 0 || index >= $scope.AgreementStockOrders.length) {
console.error('Invalid index:', index);
return;
}

console.log('Before toggle:', $scope.showDetails[index]);

// Toggle the visibility of the details section
$scope.showDetails[index] = !$scope.showDetails[index];

// Check if the details for this item have not been fetched yet
if (!$scope.AgreementStockOrders[index].stockOrderDetails) {
// Create an empty stockOrderDetails array if it doesn't exist
$scope.AgreementStockOrders[index].stockOrderDetails = [];

// Call the GetStockOrderDetails function to fetch the details
var productCode = $scope.AgreementStockOrders[index].ProductCode;
AgreementsService.GetStockOrderDetails(productCode).then(function (response) {
// Store the details in the corresponding item in AgreementStockOrders array
$scope.AgreementStockOrders[index].stockOrderDetails = response.data;
}, function (error) {
console.error('Error fetching stock order details: ', error);
});
}

console.log('After toggle:', $scope.showDetails[index]);
};


А ниже мой HTML:

Stock Order Detail






Product code
Barcode
Description
PA Stock Required
DC SOH
Store SOH
Order Qty
Order Value













{{ item.ProductCode }}
{{ item.Barcode }}
{{ item.Description }}
{{ item.PAStockRequired }}
{{ item.DcSoh }}
{{ item.StoreSoh }}
{{ item.OrderQty }}
{{ item.OrderValue | number:2 }}










Store code
Store name
PA Stock Required
DC SOH
Store SOH
Weekly Mvmt
Order Qty
Order Value
Comments







{{ detail.StoreId }}
{{ detail.StoreName }}
{{ detail.PAStockRequired }}
{{ detail.DcSoh }}
{{ detail.StoreSoh }}
{{ detail.RateOfSale }}

{{ detail.OrderValue | number:2 }}








Save












Total:
{{ total}}







Подробнее здесь: https://stackoverflow.com/questions/783 ... in-angular

Вернуться в «C#»