我試圖從重新排序後從列表中刪除單個項目,但它似乎從單擊列表中刪除多個項目。無法從列表中刪除項目?
代碼:
var testApp = angular.module('testApp', ["kendo.directives"]);
testApp.controller('testController', ['$scope', function($scope) {
$scope.mapList = [];
$scope.addMap = function() {
$scope.mapList.push({
'mapNameList': [{
'mapName': 'Test1'
}]
});
};
$scope.placeholder = function(element) {
return element.clone().addClass("placeholder").text("drop here");
};
$scope.hint = function(element) {
return element.clone().addClass("hint"); >>---- i feel issue is because of this part but not sure
};
$scope.removeItem = function(data, index) {
data.mapNameList.splice(index, 1); // it removes multiple but fires one time .
};
$scope.addMap = function() {
$scope.mapList.push({
'mapNameList': [{
'mapName': 'Test1'
}]
});
};
$scope.addDetail = function(data) {
data.mapNameList.push({
'mapName': "Test"
});
};
}]);
樣品工作撥弄here
重現步驟://指撥弄鏈接
1)單擊添加地圖。
2.)現在單擊添加詳細信息5次。
3.)現在嘗試通過拖拽&下來重新排序記錄。
4.)點擊任何刪除按鈕。
- 它將刪除多個記錄當刪除按鈕被點擊&工作刪除進一步停止。
沒有爲我工作。添加3個細節,先放置最後一個,然後刪除他。仍然刪除多個。 – tpsilva
唉,奇怪。除了使用少於三個對象外,我以相同的方式測試它。它似乎只有當某個東西被重新排序到一個索引以上時纔會中斷。我會再看看 – joh04667
太奇怪了,它可能是bug或與kendo sortable @tpsilva有關 –