Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery ->
- #this is a fix; when a tr is dragged with jQuery UI sortable
- #the cells lose their width
- cells = $('.table').find('tr')[0].cells.length
- desired_width = 940 / cells + 'px'
- $('.table td').css('width', desired_width)
- $('#sortable').sortable(
- axis: 'y'
- items: 'tr'
- stop: (e, ui) ->
- ui.item.children('td').effect('highlight', {}, 1000)
- update: (e, ui) ->
- item_id = ui.item.data('item_id')
- position = ui.item.index()
- $.ajax(
- type: 'POST'
- url: $(this).data('update_url')
- dataType: 'json'
- data: { id: item_id, menu_item: { row_order_position: position } }
- )
- )
Add Comment
Please, Sign In to add comment