Skip to content

Instantly share code, notes, and snippets.

@danjellesma
Last active October 12, 2015 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danjellesma/6eb2e448c08b2c55f476 to your computer and use it in GitHub Desktop.
Save danjellesma/6eb2e448c08b2c55f476 to your computer and use it in GitHub Desktop.
Fix Datatables sort images not working in Rails

Fix the sort images not working by editing jquery.dataTables.css

  1. Rename jquery.dataTables.css to jquery.dataTables.css.erb
  2. Update the image paths like below
table.dataTable thead .sorting {
  background-image: url(<%= image_path("sort_both.png") %>);
}
table.dataTable thead .sorting_asc {
  background-image: url(<%= image_path("sort_asc.png") %>);
}
table.dataTable thead .sorting_desc {
  background-image: url(<%= image_path("sort_desc.png") %>);
}
table.dataTable thead .sorting_asc_disabled {
  background-image: url(<%= image_path("sort_asc_disabled.png") %>);
}
table.dataTable thead .sorting_desc_disabled {
  background-image: url(<%= image_path("sort_desc_disabled.png") %>);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment