Hello,
Please, I look for some help with the stock.
I have 6 items (cards) on my stock displayed in line and I would like to switch 2 items inside this stock.
In php side, to switch 2 cards I use moveCard method and switch their positions (location_arg) in database. It works fine.
In js side, there is an issue.
After moveCard in php, I notify js and use slideToObject methode to slide my 2 cards. The animation is fine, cards switch fine.
But after some tests, I realized than the order of my items is not updated after switch. this.mystock.getAllItems() shows items in exactly same order than before switch.
So the HTML blocks of items are not in the right order than displayed (HTML is like getAllItems, always in before switch order). So my stock is no more the mirror of the display and the database. And for the next actions it is a problem.
My HTML before and after switch:
And after screen refresh, the items order is ok:
If someone have a clue or solution or alternative solution to switch some items inside the same stock ?
Thank you for your help.
Please, I look for some help with the stock.
I have 6 items (cards) on my stock displayed in line and I would like to switch 2 items inside this stock.
In php side, to switch 2 cards I use moveCard method and switch their positions (location_arg) in database. It works fine.
Code: Select all
$this->mystock->moveCard($card_id_1, 'onboard', $card_2_location_arg);
$this->mystock->moveCard($card_id_2, 'onboard', $card_1_location_arg);
After moveCard in php, I notify js and use slideToObject methode to slide my 2 cards. The animation is fine, cards switch fine.
Code: Select all
this.slideToObject( 'board_card_item_'+notif.args.card_1.id, 'board_card_item_'+notif.args.card_2.id ).play();
this.slideToObject( 'board_card_item_'+notif.args.card_2.id, 'board_card_item_'+notif.args.card_1.id ).play();
So the HTML blocks of items are not in the right order than displayed (HTML is like getAllItems, always in before switch order). So my stock is no more the mirror of the display and the database. And for the next actions it is a problem.
My HTML before and after switch:
Code: Select all
<div id="board_card">
<div id="board_card_item_1" class="stockitem "></div>
<div id="board_card_item_2" class="stockitem "></div>
</div>
Code: Select all
<div id="board_card">
<div id="board_card_item_2" class="stockitem "></div>
<div id="board_card_item_1" class="stockitem "></div>
</div>
Thank you for your help.