Comments (14)
The workaround that I came up with:
# all_sites_grid.rb
class AllSitesGrid < BaseGrid
scope do
[]
end
end
# sites_controller.rb
grid = AllSitesGrid.new do
Site.dataset.paginate(1, 25).to_a
end
from datagrid.
Can you open the console and run Site.dataset.paginate(1, 25)
? If it generates an exception for you, there is nothing datagrid can do about it and you are using sequel incorrectly. You may search for support in sequel forums.
Anyway, your grid imitation code looks incorrect. It should be:
grid = AllSitesGrid.new do |scope|
scope.paginate(1, 25)
end
from datagrid.
It works in the console:
irb(main):001:0> Site.dataset.paginate(1, 25)
=> #<Sequel::Postgres::Dataset: "SELECT * FROM \"sites\" LIMIT 25 OFFSET 0">
Not sure what you mean by grid imitation, but this is the error with your suggestion:
NoMethodError: undefined method `paginate' for Site:Class
from datagrid.
Try the following:
# all_sites_grid.rb
class AllSitesGrid < BaseGrid
scope do
Site.dataset
end
end
# sites_controller.rb
grid = AllSitesGrid.new do |s|
s.paginate(1, 25)
end
from datagrid.
The same error even on master
:
Sequel::Error: You cannot paginate a dataset that already has a limit
from datagrid.
Try the following in console:
AllSitesGrid.new.scope.paginate(1,25)
AllSitesGrid.new.assets.paginate(1,25)
What is the result?
from datagrid.
irb(main):001:0> AllSitesGrid.new.scope.paginate(1, 25)
=> #<Sequel::Postgres::Dataset: "SELECT * FROM \"sites\" LIMIT 25 OFFSET 0">
irb(main):002:0> AllSitesGrid.new.assets.paginate(1, 25)
=> #<Sequel::Postgres::Dataset: "SELECT * FROM \"sites\" LIMIT 25 OFFSET 0">
from datagrid.
Try the following too:
AllSitesGrid.new{|s| s.paginate(1,25)}.assets.to_a
Also, let me know, which specific line is showing up in the backtrace with the error.
from datagrid.
Sorry, but can't you try it? It should be easy to reproduce.
from datagrid.
I did. It is not reproducing.
from datagrid.
The test fails though.
Also, doing scope.limit(10)
results in the same error.
from datagrid.
I have no idea how limit appears in your code. You need to provide a full controller action, view, grid and model source code.
from datagrid.
See #312.
from datagrid.
Thanks!
from datagrid.
Related Issues (20)
- Link to grid with specific filter enabled HOT 2
- Passing current_user to filter with a checkbox HOT 3
- Select all and row checkboxes HOT 2
- Date filter renders as text input HOT 9
- Ajax enum/select filter HOT 1
- Upgrade to 1.6.2 broke column_names_filter HOT 4
- Preserve nested query params on order links HOT 2
- Example of the grid with json data type? HOT 2
- How to filter data for an attribute that is not part of the Datagrid object? HOT 2
- Unable to change column position unless the model grid file is updated HOT 6
- Ability to set data attributes for from and to in a range HOT 7
- add header to filter type enum or xboolean HOT 2
- Rails 7 support? HOT 2
- Custom driver HOT 4
- Receiving a 302 error when searching HOT 4
- UI without HTML Table element HOT 2
- Multiple rows per asset HOT 12
- Full HTML rendering context for empty state HOT 3
- Order error with batches HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datagrid.