var query;
$scope.gridControls = {
+ forceOrder : function () {
+ return { field : 'id', order : bucketSvc.pendingList };
+ },
setQuery : function(q) {
if (bucketSvc.pendingList.length)
return {id : bucketSvc.pendingList};
{}
).then(function(copy) {
if (copy) {
- bucketSvc.pendingList.push(copy.id());
- $scope.gridControls.setQuery({id : bucketSvc.pendingList});
+ var seen = bucketSvc.pendingList.filter(function (e) { return e == copy.id()}).length;
+ if (!seen) {
+ bucketSvc.pendingList.push(copy.id());
+ $scope.gridControls.setQuery({id : bucketSvc.pendingList});
+ }
bucketSvc.barcodeString = ''; // clear form on valid copy
} else {
$scope.context.itemNotFound = true;
$scope.selected[grid.indexValue(item)] = true
}
}).finally(function() {
+ if (grid.controls.forceOrder) {
+ var f = grid.controls.forceOrder().field;
+ var o = grid.controls.forceOrder().order;
+ var ordered_items = [];
+ angular.forEach(o, function(v) {
+ ov = $scope.items.filter(function (i) {
+ var test_val = i[f];
+ if (angular.isFunction(test_val)) {
+ test_val = i[f]();
+ }
+ return v == test_val;
+ });
+ if (ov && angular.isArray(ov)) {
+ ordered_items.push(ov[0])
+ }
+ });
+ $scope.items = ordered_items;
+ }
console.debug('egGrid.collect() complete');
grid.collecting = false
$scope.selected = angular.copy($scope.selected);