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

Need help for manual api #358

Closed tititoof closed 4 years ago

tititoof commented 4 years ago

Hi,

I want to use your gem for my project, I've read a lot your gem configuraiton but i think, i do something wrong.

I create ContactsDatatable like this :

ContactsDatatable

And in ContactsController :

ContactsController

I use a Nuxtjs front for my project, so I send manually my queries like this : ContactsAPI

My data : { "draw"=>"1", "length"=>10, "start"=>0, "order"=>{}, "columns"=>{ "0"=>{"data"=>"name", "name"=>"", "searchable"=>true, "orderable"=>true}, "1"=>{"data"=>"phone", "name"=>"", "searchable"=>true, "orderable"=>true}, "2"=>{"data"=>"mobile", "name"=>"", "searchable"=>true, "orderable"=>true}, "3"=>{"data"=>"email", "name"=>"", "searchable"=>true, "orderable"=>true}, "4"=>{"data"=>"address", "name"=>"", "searchable"=>true, "orderable"=>true}, "5"=>{"data"=>"id", "name"=>"", "searchable"=>true, "orderable"=>true}}, "contact"=>{}}

I've got this error : NoMethodError 'undefined method `[]' for nil:NilClass)

I'm wrong but where ? (Like when I populate my order informations, it does nothing ... I'm bad, sorry for disturb

tititoof commented 4 years ago

I resolve my error, Needed to set contact_name for name, etc..