Comments (6)
working non-working demo is available here
http://grahovo.iriscouch.com/ws/3/JsonRest.html
lines 165 to 176 in custom/JsonRest.js
17 rows in viewport
25 rows returned
79 rows available and should be reported by results.total
slidebar should be about 1/5 of viewport height (17 / 79)
it should not be more than half or 17 / 25
thanks
from dgrid.
As I told you earlier on IRC, you need to be setting total on the immediate return of the results object. Setting it within the promise means it's not set immediately, which also means QueryResults is probably defaulting it to the length of the returned result set (which is only the length of the page - 25).
Here's an expansion of what I was trying to tell you on IRC earlier:
var dfd = xhr("GET", {
url: this.target + (query || ""),
handleAs: "json",
headers: headers
});
var results = dfd.then(function(response){
// dig out the inner property containing the array of items
return response.rows;
});
// Assign a promise to the total property on the results object being returned;
// this promise will be resolved around the same time as the previous one
results.total = dfd.then(function(response){
return response.total_rows;
});
// Now wrap the results object; since it already has total defined,
// QueryResults should leave it alone, and consumers should pick it up properly.
return QueryResults(results);
from dgrid.
I have uploaded dojo source to help wih trying to debug minified cdn code.
it's here http://grahovo.iriscouch.com/ws/4/JsonRest.html
from dgrid.
@kfranqueiro the promise returned from xhr is frozen and so results.total
cannot be assigned to it. i believe this is also a bug in JsonRest store. (cc: @kriszyp) assigning to results.total
is futile in browsers that support Object.freeze
.
the right way to do this for @teslan is along these lines
var dfd = new Deferred();
var results = = xhr("GET", {
url: this.target + (query || ""),
handleAs: "json",
headers: headers
});
Deferred.when(results, function (response) {
return response.rows;
}, dfd.reject);
dfd.total = Deferred.when(results, function (response) {
return response.total_rows;
});
return QueryResults(dfd);
or use delegate
as is done in QueryResults. someone want to open a bug in dojo?
from dgrid.
the delegate
version looks something like this:
var dfd = xhr("GET", {
url: this.target + (query || ""),
handleAs: "json",
headers: headers
});
// wrap the frozen promise so we can assign properties to the wrapper
var results = lang.delegate(dfd.then(function (response){
return response.rows;
}));
results.total = dfd.then(function(response){
return response.total_rows;
});
return QueryResults(results);
from dgrid.
opened dojo bug for JsonRest - http://bugs.dojotoolkit.org/ticket/14930
from dgrid.
Related Issues (20)
- ColumnSets with CompoundColumns and ColumnResizer does not always resize correctly.
- horizontal scrolling alignment issue dgrid
- horizontal HOT 1
- rowindex HOT 1
- Is this project still maintained? HOT 2
- DGrid 'select all' checkbox is not working as expected HOT 2
- OnDemandList does not refresh on store.setData HOT 2
- build issues with dojo 1.16 HOT 7
- Editor focusout handler is stopped when a row is removed
- CheckBox Editor does not work as expected in Safari HOT 3
- Removed row handing in Editor onblur HOT 2
- Editor: browser blur with active Select leads to bugged editor
- Update Intern from 3 to 4
- (ColumnSet +) CompoundColumns_findSortArrowParent(field) fails to find parent out of the 1st column set
- Website still points to v1.2.1
- Dgrid selector inconsistently working in touch screen devices like ipad dgrid/v1.1.0 HOT 10
- dgrid version 1.3.3 is breaking formatter function in dgrid HOT 2
- How to set dgrid editor checkbox readonly conditionally ?
- dgrid does not throw error on scroll (http-status-code) HOT 2
- dgrid.cell().element is undefined
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 dgrid.