Guest User

Untitled

a guest
Dec 10th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. jQuery ->
  2. #this is a fix; when a tr is dragged with jQuery UI sortable
  3. #the cells lose their width
  4. cells = $('.table').find('tr')[0].cells.length
  5. desired_width = 940 / cells + 'px'
  6. $('.table td').css('width', desired_width)
  7.  
  8. $('#sortable').sortable(
  9. axis: 'y'
  10. items: 'tr'
  11. stop: (e, ui) ->
  12. ui.item.children('td').effect('highlight', {}, 1000)
  13. update: (e, ui) ->
  14. item_id = ui.item.data('item_id')
  15. position = ui.item.index()
  16. $.ajax(
  17. type: 'POST'
  18. url: $(this).data('update_url')
  19. dataType: 'json'
  20. data: { id: item_id, menu_item: { row_order_position: position } }
  21. )
  22. )
Add Comment
Please, Sign In to add comment