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

Multiple issues with reorder / delete demo on Codepen. #1601

Closed
stefek99 opened this issue Jun 10, 2014 · 13 comments
Closed

Multiple issues with reorder / delete demo on Codepen. #1601

stefek99 opened this issue Jun 10, 2014 · 13 comments

Comments

@stefek99
Copy link

Docs: http://ionicframework.com/docs/api/directive/ionList/
Pen: http://codepen.io/ionic/pen/JsHjf
Video: https://www.youtube.com/watch?v=DAWCYDnw7Q0 (127 seconds)

Issues:

  • reoder
  • mangled markup in header
  • where are buttons to edit and share
  • not passing fromIndex and toIndex to reorder function (that is causing ng-repeat to choke)

My related question on StackOverflow: http://stackoverflow.com/questions/24139967/how-to-pass-multiple-arguments-to-ionic-reorder-directive


I know that you are aware: #768 (please have mine +1 on that)

@perrygovier
Copy link
Contributor

Hey @stefek99 great find, thanks!

I've updated the codepen.

  • reoder typo
  • header markup - what is mangled?
  • edit and share buttons are revealed by swiping/dragging an item to the left
  • updated reorder method params to be $fromIndex and $toIndex

@stefek99
Copy link
Author

Here:

    <ion-header-bar class="bar-positive">
      <div class="buttons">
        <button class="button button-icon icon ion-ios7-minus-outline" 
          ng-click="data.showDelete = !data.showDelete; data.showReorder = false"></button>
      </div> <!-- HERE: remove closing div -->
      <h1 class="title">Ionic Delete/Option Buttons</h1>
      <button class="button"
          ng-click="data.showDelete = false; data.showReorder = !data.showReorder">
            Reorder
          </button>
      </div>
    </ion-header-bar>

@perrygovier
Copy link
Contributor

Ah, the ionic header, I was looking in the html header. Thanks, fixed

@stefek99
Copy link
Author

Still getting:

Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: item in items, Duplicate key: object:008
http://errors.angularjs.org/1.2.12/ngRepeat/dupes?p0=item%20in%20items&p1=object%3A008
    at http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:9007:12
    at ngRepeatAction (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:28317:20)
    at Object.$watchCollectionAction [as fn] (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:20656:11)
    at Scope.$digest (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:20759:29)
    at http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:20945:26
    at completeOutstandingRequest (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:13040:10)
    at http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:13347:7 

Just start randomly reordering elements... (not sure what is the most reliable way to reproduce)

@perrygovier
Copy link
Contributor

Ah, right. It happens when dragging between iterations of 1-9, using unique ID's all the way to 50 works. Fixed. Thanks.

@stefek99
Copy link
Author

I see that items are now 0...50 but it doesn't fix the issue. (still getting a lot of red in the console)

@perrygovier
Copy link
Contributor

Ah, I see. It wasn't happening for me at first, but once I get one, there's a lot. We'll take a look.

@perrygovier perrygovier reopened this Jun 10, 2014
@stefek99 stefek99 assigned bensperry and perrygovier and unassigned bensperry Jun 11, 2014
@perrygovier
Copy link
Contributor

This one has me a bit stumped. Even when adding the track by parameter and updating to our current version of ionic, which has an updated version of angular, I get the same error.

http://codepen.io/perrygovier/pen/eHyjl?editors=101

This may be a problem in angular itself. @ajoslin can you confirm?

@ajoslin
Copy link
Contributor

ajoslin commented Jun 24, 2014

@perrygovier, what should the error be here?

I go into the codepen and reorder some delete some, reorder again, and all looks to be well. I don't see any errors in the console, either.

@perrygovier
Copy link
Contributor

It takes a while to get it to start, but after 10-20 sec of reordering, I can trigger an error in my console, where it complains of duplicate indexes. Once it starts, every reorder will trigger an error. Everything displays properly.

@berlinhudson
Copy link

I have the same issue. My current workaround is using this lib for reorder: https://github.com/JimLiu/angular-ui-tree

@perrygovier
Copy link
Contributor

As mentioned by @berlinhudson in ticket #1716, if you show the {{$index}} values in each list item, when the error begins, the index no longer recalculates.

@ajoslin ajoslin closed this as completed in ba1859b Jul 6, 2014
@inceptiveSujit
Copy link

angular.element(...).closest is not a function touchHold @ sortable.js:34

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants