Skip to content

Instantly share code, notes, and snippets.

@rauxalach
Created December 3, 2013 11:13
Show Gist options
  • Save rauxalach/7767530 to your computer and use it in GitHub Desktop.
Save rauxalach/7767530 to your computer and use it in GitHub Desktop.
Coffee
class SmartTableSetting
constructor: (form) ->
@form = $(form)
@columns = @form.find('.column')
@columns.sortable
activate: (event, ui) =>
event.preventDefault
$(this).css "background-color", "#CFCFCF"
deactivate: (event, ui) =>
event.preventDefault
$(this).css "background-color", "#FFF"
update: (event, ui) =>
@assignColumnsList
placeholder: "ui-state-highlight"
@columns.sortable "option", "connectWith", ".column"
assignColumnsList: (event) =>
alert 'hehe'
$("#new_columns_list").val $("#selected-columns .element").map((i, n) ->
$(n).attr "id"
).get().join(",")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment