leikind / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
MIT License
537 stars 215 forks source link

Bootstrap-datepicker #211

Closed cfiorini closed 9 years ago

cfiorini commented 9 years ago

I have added bootstrap-datepicker-rails that can be chosen changing Wice::Defaults::HELPER_STYLE to :bootstrap. It's an early implementation but does the job. There is a support for I18n.locale and you have two fields instead icons. For sure there some bootstrap-datepicker options that will be nice to implement...but let's start with this one :)

leikind commented 9 years ago

Thank you! I'll take a look at this this weekend.

leikind commented 9 years ago

There is a problem with checking for presence of the library. Thing is, if jQuery UI Datepicker is loaded, $.fn.datepicker also returns a truthy value, a function, even though this is a wrong library. I wonder if there is a way to differentiate between jQuery UI Datepicker and Bootstrap-datepicker in $.fn.datepicker?

leikind commented 9 years ago

Another issue is that it does not integrate into the autoreloading functionality of the plugin. Data autoreloading example: http://wicegrid.herokuapp.com/auto_reloads

Telling difference between jQuery UI Datepicker and Bootstrap datepicker is a nice-to-have, this one is more serious.

cfiorini commented 9 years ago

js check: i already tried to find a way to check if the right library is loaded but main problem is they have same name so i was thinking to check if a specific method exists...but is not the right way; i think that the best way is if those libraries hava a getter like .name with something more than datepicker. if those libraries are included through a gem is quite easy...that's why i suggest to use a gem in alert box :)

auto reloading: i'll change code for that

leikind commented 9 years ago

js check: ok, let it be so

auto reloading: thanks

cfiorini commented 9 years ago

just added auto_reload

leikind commented 9 years ago

I've merged it, but I changed the event from changeDate to hide, otherwise when the user modifies the date editing the field directly the page will be reloaded submitting an invalid date

leikind commented 9 years ago

btw bootstrap datepicker in detached filters were broken, I fixed it https://github.com/leikind/wice_grid/commit/0909cb5364d27225ebf11b414e0616ae295980c2

cfiorini commented 9 years ago

right! at next filter i'll check detached too