You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two data sources.... I drag data (addresses) from a simple array, and place them onto a complex document that stores delivery route sequencing. To minimize the size of the json, the destination objects do not already exist in the object.
Addresses may be either placed on the left or right side of the document (indicating you are delivering to the left or right side of the street).
My documents look like this
address list:
[{"address": "123 Anywhere Lane"},
{"address: "123 James Place"},
{address: " 123 Gotham City Dr"}]
the document looks like this:
array of lines. Each line can have a "left" or "right" attribute, or maybe both, which are addresses. If a left or right attribute are missing, then we can drag an address to the missing attribute.
{"lines": [
{"left":{address: "123 park ave"},
"right":{address: "123 park ave"}}, --this line already has deliveries on both sides
{}, - this line has no left or right deliveries. We can add a new delivery to either side
{"left":{address: "123 park ave"}}, this line has no right delivery. We can drag something new there.
])
What I found is that your code expects the destination ngModel to already exist as at least {}. If it doesn't, then the value is not removed from the addresses list correctly. In order to fix that, I made a small change to the mutateDraggable function:
this.mutateDraggable = function (scope, dropSettings, dragSettings, dragModel, dropModel, dropItem, $draggable) {
//var isEmpty = angular.equals(dropItem, {}),
// dragModelValue = scope.$eval(dragModel);
//6/26/2014 Rob: Changed isEmpty to also check for undefined
var isEmpty = (angular.equals(dropItem, {}) || dropItem == undefined),
dragModelValue = scope.$eval(dragModel);
It now works the way you intend it, as far as I can tell.
The text was updated successfully, but these errors were encountered:
I have two data sources.... I drag data (addresses) from a simple array, and place them onto a complex document that stores delivery route sequencing. To minimize the size of the json, the destination objects do not already exist in the object.
Addresses may be either placed on the left or right side of the document (indicating you are delivering to the left or right side of the street).
My documents look like this
address list:
[{"address": "123 Anywhere Lane"},
{"address: "123 James Place"},
{address: " 123 Gotham City Dr"}]
the document looks like this:
array of lines. Each line can have a "left" or "right" attribute, or maybe both, which are addresses. If a left or right attribute are missing, then we can drag an address to the missing attribute.
{"lines": [
{"left":{address: "123 park ave"},
"right":{address: "123 park ave"}}, --this line already has deliveries on both sides
{}, - this line has no left or right deliveries. We can add a new delivery to either side
{"left":{address: "123 park ave"}}, this line has no right delivery. We can drag something new there.
])
What I found is that your code expects the destination ngModel to already exist as at least {}. If it doesn't, then the value is not removed from the addresses list correctly. In order to fix that, I made a small change to the mutateDraggable function:
It now works the way you intend it, as far as I can tell.
The text was updated successfully, but these errors were encountered: