Code Monkey home page Code Monkey logo

Comments (13)

matt-riemer avatar matt-riemer commented on September 28, 2024 1

yea, infinite scroll would be cool :)

I tried implementing this a year or two ago, but it worked really crappy with an ajax data source. Maybe datatables.net js library has improved since then?

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 28, 2024 1

just find the line it errors on, then binding.pry figure out why it can't find it :)

It might be worth starting in /app/controllers/effective/datatables_controller.rb

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 28, 2024

What date-range picker library would you want to implement? :)

Adding the input might not be too difficult...have you seen effective_form_inputs gem? that's what I'm using for all my "wrap javascript library in a rails form helper" stuff.

But actually working with a date range instead of a singular value might require some changes to the finder.

effective_datatables uses
https://github.com/code-and-effect/effective_datatables/blob/master/app/models/effective/datatable_value_tool.rb

the datables value tool to do all the ordering/searching of arrays.

And delegates any SQL/activerecord finder stuff to an Effective::Resource object, which is in another gem, effective_resources,

It ends up here:

https://github.com/code-and-effect/effective_resources/blob/master/app/models/effective/resources/relation.rb

and maybe here:

https://github.com/code-and-effect/effective_resources/blob/master/app/models/effective/resources/forms.rb

Accepting PRs! I'd love to see what ideas you have.

Cheers :)

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 28, 2024

This is where all the search options are initialized:

https://github.com/code-and-effect/effective_datatables/blob/master/app/models/effective/effective_datatable/resource.rb#L110

And here is how they're rendered. Based on the search[:as] value

https://github.com/code-and-effect/effective_datatables/blob/master/app/helpers/effective_datatables_private_helper.rb#L33

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 28, 2024

FYI,

In effective_form_inputs
https://github.com/code-and-effect/effective_form_inputs/blob/master/app/assets/javascripts/effective_date_picker/initialize.js.coffee

It's not a date range plugin...but it automatically supports linked date pickers, as per:

http://eonasdan.github.io/bootstrap-datetimepicker/Options/

So if you have two form inputs with names like "item[start_at]" and "item[end_at]", selecting a time on the start_at picker, will set the minDate of the end_at datepicker. Linking them, kinda...

from effective_datatables.

uzaif313 avatar uzaif313 commented on September 28, 2024

can we add lazy load in data tables and fixed header of tables?
i got error while apply sort datatable not found

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 28, 2024

lazy load is a bad idea because you end up just making 2 requests instead of just 1.

Imho, you might as well prepopulate the table with the first page of records on the first GET request / initial render, instead of loading an empty datatable and then making an ajax request for the data. Especially if there's more than 1 datatable being displayed per page. T

hat's the approach I've always used! You're welcome to play with it tho, the javascript library does support it. Checkout the javascript init options at

https://github.com/code-and-effect/effective_datatables/blob/master/app/assets/javascripts/effective_datatables/initialize.js.coffee

as the datatables javascript library does support this approach.

As for the fixed headers, I I have tried implementing them before before, but wasn't able to get it working properly...

https://datatables.net/extensions/fixedheader/

You're welcome to give it a shot. Should just need to drop in the fixedheader specific javascript and css file to get it working in this gem. Cheers.

from effective_datatables.

uzaif313 avatar uzaif313 commented on September 28, 2024

by lazy load i mean infinite scroll instead of using pagination

from effective_datatables.

uzaif313 avatar uzaif313 commented on September 28, 2024

can you provide demo of that infinite scroll and i am facing issue while searching or sorting its shows me alert which contain text like
data table not found

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 28, 2024

nah, sorry I don't have any code lying around for that...check out some of the other datatables.net javascript libraries that are included...follow that pattern..

from effective_datatables.

uzaif313 avatar uzaif313 commented on September 28, 2024

while searching or sorting its shows me alert which contain text like
data table not found

from effective_datatables.

uzaif313 avatar uzaif313 commented on September 28, 2024

is it possible to retrieve collection in controller and use it in datatable class?

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 28, 2024

you could initialize the datatable in a controller

@DataTable = Klass.new(self)

then call @datatable.to_json or @datatable.collection on it.

Search for the hooks, check out def finalize

https://github.com/code-and-effect/effective_datatables/blob/master/app/models/effective/effective_datatable/hooks.rb

from effective_datatables.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.