我有一个要求,我必须将特定产品添加到数据表并重新绑定数据表,以便更新其计数。我正在使用 MVC 和 angularjs 1.6.2
我正在创建数据表,如下所示:
<table id="dtProducts" ng-if="AllProducts"
class="table manage-user-table offer-mgt-table market-selection-tab"
datatable="ng" dt-options="dataTableOpt">
<thead>
<tr>
<th><input type='checkbox' class="selectAllMarket"
value='SelectAll' ng-model="selectAll" >
</th>
<th>Product Name</th>
<th>Product Type</th>
</tr>
</thead>
<tbody>
<tr dt-rows ng-repeat="product in AllProducts">
<td><input type="checkbox" class="selectMarket"
ng-model="product.selected"
data-offerid="{{product.ID}}"
ng-click="toggleSelect(product.selected, $index)">
</td>
<td>{{product.Name}}</td>
<td>{{product.VerticalType.VerticalTypeDisplayName}}</td>
</tr>
</tbody>
</table>
There a section on a view that contains a text box to take product name and a dropdown to take product type.It also contains an Add button on clicking the button a post is hit on the server to save that product and on the success of that post on front end i call function to reload the AllProducts
. As soon as that function is called i get the error
TypeError:o.ngDestroy 不是 angularjs dataTables 中的函数。
在表中保存产品后,通过以下代码重新加载数据表
var getAllProducts = function () {
var urlgetAllProducts = apiURL + "/AllProducts?providerId=" + providerID;
$http({
url: urlgetAllProducts,
method: 'GET', //$scope.customization,
}).then(function successcallback(response) {
$scope.AllProducts = response.data.ResponseData;
$scope.$parent.AllProducts = $scope.AllProducts;
if ($scope.offer.ProductList != undefined) {
MakeSelected();
$scope.selectProducts();
}
},
function errorcallback(response) {
}).then(function () {
});
}
有人可以在这方面帮助我吗?我正在使用 AngularDataTables 0.6.2。如果需要,我可以提供更多详细信息。谢谢
我找到了解决方案。我懒惰地绑定了库,因此导致了问题。通过将加载部分放入 setTimeout 中,它就像一个魅力
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)