Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static element in ul list getting moved around on drag of another elements #260

Closed
diimpp opened this issue Feb 4, 2015 · 7 comments
Closed

Comments

@diimpp
Copy link

diimpp commented Feb 4, 2015

Hi,

I've bootstrap tabs in angular app.
I think there is actually two issues, which is not repeating in two other angular dragable (angular-sortable-view, ng-sortable)
alt tag

  1. Create two tabs, drag them around, static element (+ "Add new tab") in place, but after adding new tab to ng-repeat it's get added after static element, which is not suppose to happen.
  2. Create three+ tabs, drag them around, static element got moved. For example in jsfiddle from this issue Item should stay at the same Position #258 http://jsfiddle.net/5f89rac9/2/ static element always in place.

My setup.

          $scope.tabsSortableOptions = {
             animation: 150,
             draggable: '.draggable',
             filter: '.non-draggable',
         }; 
<ul class="nav nav-tabs" ng-sortable="tabsSortableOptions">
    <li ng-repeat="workspace in tabs.workspaces" ng-class="{'active': state.isActive(workspace.id)}" class="draggable">
        <a ng-click="state.setActive(workspace.id)">
            {{ workspace.name }}
         </a>
    </li>
    <li class="non-draggable">
        <a ng-click="state.addNew()">
            <i class="fa fa-plus-circle"></i>
         </a>
    </li>
</ul>                          
@diimpp
Copy link
Author

diimpp commented Feb 4, 2015

On second thought:
Number of tabs is irrelevant. Static element could be moved with two tabs too.
But instead how I'm dragging is important.

  • If I'm to accuratly move two tabs -- then new tab would be before static element (Good)
  • If I'm to madly move them around -- then new tab will appear after static element (Bad)

@diimpp
Copy link
Author

diimpp commented Feb 4, 2015

Plus it adding NULL element to ng-repeat var on sorting.

@RubaXa RubaXa changed the title [Bug][Angular] Static element in ul list getting moved around on drag of another elements Static element in ul list getting moved around on drag of another elements Feb 7, 2015
@RubaXa
Copy link
Collaborator

RubaXa commented Feb 7, 2015

Alas, I can only offer this: http://jsbin.com/hopuvukaya/1/edit?html,js,output

P.S. About #258: the library does not yet support the tree view.

@diimpp
Copy link
Author

diimpp commented Feb 9, 2015

Thank you, Konstantin.

Is it related with how Sortable looking at ng-repeat without explicit mapping to model?
I think I saw thread about it at habr.

@RubaXa
Copy link
Collaborator

RubaXa commented Feb 9, 2015

Can you give an example?
There is a similar issue #267, but I just do not understand what for?!

@diimpp
Copy link
Author

diimpp commented Feb 9, 2015

Not sure if understand you.
For me issue is resolved, as I choose another library.
If it is not a bug, should I close issue?

@RubaXa
Copy link
Collaborator

RubaXa commented Feb 9, 2015

It is not a bug.

@RubaXa RubaXa closed this as completed Feb 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants