ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: Ionic Slide Box Breaks on splice an item. Goes to last index and overlaps.

Open scripterkaran opened this issue 11 years ago • 16 comments

Type: bug

Platform: ios 8 webview

Here is the code pen that shows the error. Try removing the item , example product 3, the slide box slides to last product and overlaps the other items. ( see the pager, it moves )

http://codepen.io/anon/pen/qEvyLV?editors=101

any help would be big help.

EDIT: I included a $ionicSlideBoxDelegate.update(); on slide change function, it seems to slightly fix the issue but only on slide change. Its not a 100% solution. Check Code pen.

scripterkaran avatar Mar 30 '15 09:03 scripterkaran

The slidebox implementation is broken when you try to update the underlying collection.

Just another demonstration of it. Also, my last comment links to a branch that has not been included in the RC's yet that contains an overhaul of the slidebox implementation. https://github.com/driftyco/ionic/issues/3076

agnellvj avatar Mar 30 '15 17:03 agnellvj

If you give the slidebox a millisecond or two for some asynchronous actions, it looks to work properly: http://codepen.io/perrygovier/pen/QwoPbb?editors=101

Let me know if that doesn't resolve the issue

perrygovier avatar Mar 30 '15 23:03 perrygovier

This is a good try, but unfortunately, its all messy now also, if I splice 1st product it goes to product3, and one major problem , if I splice last object (product 11) it splices behind leaving the screen blank.. @perrygovier

scripterkaran avatar Mar 31 '15 05:03 scripterkaran

Possible work around I found to this problem: setting a SetInterval javascript function. though its not 100% correct , it is one of the workaround when you want to splice slidebox slides.

here is a code pen for the same: http://codepen.io/anon/pen/qEvyLV?editors=101

scripterkaran avatar Apr 22 '15 09:04 scripterkaran

I'm having a very similar issue on Android as well, Looks like some users (including me) found this closed issue and are posting there:

https://github.com/driftyco/ionic/issues/1578#issuecomment-74268456

CodyMorris avatar May 13 '15 17:05 CodyMorris

@CodyMorris have you tried the suggestion of calling update multiple times in a $timeout? It is the only known workaround right now with what is released. I use a loop that runs every 250ms for 4 times just to be sure.

agnellvj avatar May 13 '15 21:05 agnellvj

@agnellvj Yes thats exactly what I do right now. I have set out a Interval function of javascript to call update every 200ms for 2 seconds.

scripterkaran avatar May 14 '15 04:05 scripterkaran

Is there any fix of this issue? Please update.

omprakash1989 avatar May 22 '15 12:05 omprakash1989

@agnellvj yeah, that works but its definitely not ideal - thanks for the reminder though

CodyMorris avatar May 22 '15 15:05 CodyMorris

Well...This worked for me though this is not a solution of the bug. $scope.trashMe = function(index) { var indexToremove = $ionicSlideBoxDelegate.currentIndex(); $scope.next(); $timeout(function() { var data = $scope.slideData; data.splice(indexToremove, 1); $scope.slideData = data; $ionicSlideBoxDelegate.update(); }); $scope.previous(); };

omprakash1989 avatar May 25 '15 05:05 omprakash1989

Hey guys, look at PR: https://github.com/driftyco/ionic/pull/3842

It's all broken because of angular ngAnimate, disabling it on the ionSlideBox directive works.

A timeout would just be a workaround. Let me know if that suits!

labrute974 avatar May 27 '15 06:05 labrute974

Having same issue.

craigvl avatar Jul 24 '15 04:07 craigvl

Any progress in this issue, still facing the problem.

yesir1006 avatar Sep 16 '15 12:09 yesir1006

having same problem, do you solved the problem?

Chaunjie avatar Oct 27 '15 09:10 Chaunjie

Hey everyone, can you try the new slidebox just pushed to master (available in upcoming 1.2):

<ion-slides options="options">
  <ion-slide-page>
  </ion-slide-page>
</ion-slides>

mlynch avatar Dec 09 '15 00:12 mlynch

New slidebox should fix this ,closing until I get confirmation

mlynch avatar Dec 09 '15 01:12 mlynch