Click here to Skip to main content
15,920,053 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have this code below that allows me to move the value from Green Fruits Table to Random Fruits Table and vice versa but the problem is that after I move all the value from Suggested Fruits Table to Green Fruit Table all the value comes back as a single column and i want it to follow the original format which is 3 cells in a row. Is there any easy way to accomplish this? Any help would be greatly appreciated.

What I have tried:

Here is my JSFiddle[^]
Posted
Updated 17-Jun-18 1:02am

1 solution

Every time you move a fruit from 'Suggested' to 'Green' you are creating a new TR/TD for that fruit - so it will be displayed as new line (TR)...
You have to options:
1. Find the last row of 'Green' and check if there is room there (less then 3 TDs)... If there is room add the new fruit as new TD inside the last row (TR), otherwise do as you do today (new TR/TD)
2. Use flex-gird and DIV not TABLE/TR/TD
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900