jbox-web / ajax-datatables-rails

A wrapper around DataTable's ajax methods that allow synchronization with server-side pagination in a Rails app
MIT License
585 stars 228 forks source link

Setting 'display' vs 'sort' values #345

Open toomanyjoes opened 4 years ago

toomanyjoes commented 4 years ago

Datatables gives you the ability to map data like so:

{
  '0' => { 'display' => submission.date_and_time, '_' => submission.date_and_time, 'sort' => submission.timestamp },
  '1' => submission.submitter_initials,
  '2' => submission.title
}

This lets the datatable know that the sort column value is different than the value that it should display.

Is there any way to achieve this using this gem?

If I try this same approach and stick to this gems documentation I just see the whole hash as text in my table.

Also thank you for all the great work. I spent a few hours getting my code working but it was quite wonderful once everything was in place.

klyonrad commented 4 years ago

Datatables gives you the ability to map data like so

What exactly are you refering to?

This does not seem reasonable. Is it even possible to have an Ajax powered datatable where the sorting is not done through the backend? And if you want the the complete data loaded in the frontend you don't exactly need the gem...