Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to turn off "wice_grid.js not loaded" message #82

Closed
asgeo1 opened this issue Jan 14, 2013 · 3 comments
Closed

Ability to turn off "wice_grid.js not loaded" message #82

asgeo1 opened this issue Jan 14, 2013 · 3 comments
Assignees

Comments

@asgeo1
Copy link
Contributor

asgeo1 commented Jan 14, 2013

I like to load my JS assets at the bottom of my page, not in the head.

If I do that, then I get a JS error from the following code wicegrid inserts mid-way into the page:

//<![CDATA[
$(document).ready(function(){ 
  if (typeof(WiceGridProcessor) == "undefined"){
    alert("wice_grid.js not loaded, WiceGrid cannot proceed!\n" +
      "Make sure that you have loaded wice_grid.js.\n" +
      "Add line\n//= require wice_grid.js\n" +
      "to app/assets/javascripts/application.js")
    }
  }) 
//]]>

because "$ is undefined".

I know it only inserts this message in development, but it's still annoying.

Could you put a setting in somewhere so it can be turned off?

@ghost ghost assigned leikind Jan 15, 2013
@leikind
Copy link
Owner

leikind commented Jan 15, 2013

I think the correct solution would be to rewrite $(document).ready in plain javascript without jQuery

@leikind
Copy link
Owner

leikind commented Jan 21, 2013

Please verify if version 3.2.1.pre3 fixes the problem http://rubygems.org/gems/wice_grid/versions/3.2.1.pre3

@leikind leikind closed this as completed Jan 23, 2013
@webchi
Copy link

webchi commented Mar 15, 2016

Still have this error at 3.6.0.pre4

afdev82 added a commit to adnotam/wice_grid that referenced this issue Oct 24, 2024
afdev82 pushed a commit to adnotam/wice_grid that referenced this issue Oct 24, 2024
Only call group when there actually is a group set in WiceGrid#read relation

This fixes a bug with wrong paginated result set when having a wice_grid with
an include or column with assoc option on a many association. If this is the
case the grid tries to eager load this association (due to the include/references
on the relation). Rails then normally gets the correct page set by performing an
additonal query to get the matching IDs without the eager load, however this
functionality is disabled when there is a group set on the relation. Because
WiceGrid always called group even when there was no group set this behaviour was
always disabled, leading to an incorrect page set.

By only calling group when there actually is a group we fix this problem in most
cases. However, when providing a group to the grid, problems still occur, but so
does providing a group to a relation with eager load in PostgreSQL in Rails
itself already (e.g. `Author.eager_load(:books).group(:id)`). It might be better
to never eager load associations, but instead always preload them and add the
sort/filter conditions using a left_joins (in combination with a distinct to get
each main model only once).

Also return Arel in get_custom_order_reference when custom order is SqlLiteral

Fixes 'Query method called with non-attribute argument(s)' when using Arel.sql
for custom order in combination with Ruby 3. Should already have been fixed when
the deprecation warning was fixed, but apparently it was not.

Fixup c7a9da2

fix for issue leikind#82
afdev82 added a commit to adnotam/wice_grid that referenced this issue Oct 24, 2024
afdev82 added a commit to adnotam/wice_grid that referenced this issue Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants