Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

sorted array is not retained #560

Open
@jyoti-openair

Description

@jyoti-openair

So, I have an array as

var groups = [{
  name: 'Applicants',
  place: 'NY'
},{
  name: 'Volunteer',
  place: 'CA'
},{
  name: 'Others',
  place: 'LA'
}];

so when I drag and sort it. I'm saving it to cookies. as follows:

var groupsObj = {
    groups: ui.item.sortable.droptargetModel
}
$cookies.putObject('groups', groupsObj);

when I console.log ui.item.sortable.droptargetModel it gives me correct sorted array. ex:

[{
  name: 'Applicants',
  place: 'NY'
},{
  name: 'Others',
  place: 'LA'
},{
  name: 'Volunteer',
  place: 'CA'
}];

But when I get the cookies as follows:

$cookies.getObject('groups');
it's giving me initial array instead of sorted array.

[{ name: 'Applicants',
  place: 'NY'
},{
  name: 'Volunteer',
  place: 'CA'
},{
  name: 'Others',
  place: 'LA'
}];

I'm not sure what the problem is, is it reference problem ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions