On Tuesday, May 30, 2017 at 2:10:36 PM UTC-7, Elanor Riley wrote:
>
> Hey all,
>
> I'm attempting to use DataTables server-side processing to display 
> information and using Sequel as my database layer.
>
> I've successfully rendered JSON output for my objects, the issue now is 
> that we have so many records that it's taking several seconds for the DOM 
> to process and load all these. So I'd like to use the dynamic functions of 
> datatables with Sequel.
>
> I couldn't find a built in plugin, but I can manually write the limits and 
> other filters without too much issue.
>
> However, the biggest issue is that datatables requires two additional 
> parameters in the JSON output to let it know how many records exist and how 
> many to display. Unfortunately I can't figure out how to add this to the 
> JSON output from Sequel.
>
> Is there a way to add arbitrary parameters to the JSON output from Sequel? 
> If not, any ideas on how to serialize Sequel objects into a JSON string and 
> concatenate additional params? Thanks!
>

There currently isn't a good way to do it using the json_serializer plugin, 
unless you want to add model instance methods for it.  I'm considering 
having to_json take a block that yields the hash, and then serializing the 
block's return value to JSON, but haven't implemented that yet.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to