Episodes
walldeau said over 2 years ago on Sorting from Scratch :
Hi, this trello series is amazing.  I am not sure if I am allowed to ask some specific coding questions here but here goes. 

I am using this each as a budgeting card such that each card has an amount and below that supposedly a running balance from the amounts from the cards on the top. The idea is to make the cards draggable to the order of payment and to park some expenses on other columns which are not for processing. I was able to find a way to add a running amount field in each item and update each item with the latest running amount as the order is being updated and stored. The problem is it is not being sent back to view the updated running amount without reloading the page. Can you suggest some episodes to watch for this?


David Kimura PRO said over 2 years ago on Sorting from Scratch :
  That's an interesting use case. If i'm understanding correctly, my first thought would be a state which can be updated based on the dragging actions. https://stimulusjs.org/handbook/managing-state


walldeau said over 2 years ago on Sorting from Scratch :
Hi,

Thanks for the stimulus handbook link. I've been tweaking and playing around using hints from the article but it I can't find a way to make the computation in view as the order changes, I need to read more and need more time to learn I guess. 

While I am at it, for the meantime I am thinking of sticking to my old inefficient approach just to make my app useable already--after rearranging the items, I go to the web browser's address bar and hit enter to reload the page. 

To automate this, I tried using these two but they don't seem to reload the items (does not reflect the updated running amount).
redirect_to :back
redirect_to @list

If I may ask one more further: Is there a way to do this in the controller such that it reloads everything in the page as good as manually hitting enter key in the address bar?




David Kimura PRO said over 2 years ago on Sorting from Scratch :
  You might be able to do it with this

redirect_to @list, turbolinks: false



walldeau said over 2 years ago on Sorting from Scratch :
Thank  you   , I'll try it.

almokhtar said about 2 years ago on Sorting from Scratch :
  i really didn't understand the issue bellow can you please tell me why you changed column by list
  def set_item
    @item = @list.items.find(params[:id])
  end
the item moved between columns not lists ?? what i'm missing ?

David Kimura PRO said about 2 years ago on Sorting from Scratch :
  If we just searched by column then when we moved an item from one column to a different one, it wouldn't be found. That's why we have to search based on the list instead of the column.

Login to Comment