0

Here is my code:

        <script>
require(["dojox/grid/DataGrid", "dojo/store/Memory","dojo/data/ObjectStore", "dojo/store/JsonRest", "dojo/_base/xhr", "dojo/domReady!"], 
        function(DataGrid, Memory, ObjectStore, JsonRest, xhr){

    var gridSimple,
        store,
        dataStore;

    function createGrid(){

        gridSimple = new DataGrid({
            store: dataStore,
            structure: [
                { name: "Name", field: "name", width: "84px" },
                { name: "Last name", field: "lastName", width: "84px" },
                { name: "e-mail", field: "email", width: "120px" }
            ],
            rowsPerPage: 20,
            autoHeight:15,
            selectionMode: "single"     
        }, "grid");

        gridSimple.startup();
    }

    function init(){
        store = new JsonRest({target:  "/users/"});
        dataStore = ObjectStore({objectStore: store});  
        createGrid();
    }

    init();
});
</script>               

    <div id="grid">

    </div>

I'm getting the first page (The Range header is being sent), but when scrolling down nothing happens, dojo is not sending the next request. Not sure what I'm doing wrong.

I'm on firefox 14.0.1, btw the scroll is really really slow using the mouse wheel. I also tried in chrome, not getting next page, but at least the mouse wheel works just fine.

Dojo version: 1.7.2

Alex Pi
  • 816
  • 4
  • 12
  • 28

1 Answers1

2

The problem was I had to add the next header to my response:

response.addHeader("Content-Range", "items " + from + "-" + to + "/" + total);

I did not know this. It is what they call the "REST Paging standard". http://dojotoolkit.org/reference-guide/1.7/dojo/store/JsonRest.html#id7

On the other hand, firefox is scrolling painfully slow. Not happening in chrome.

Here is the bug report:

http://bugs.dojotoolkit.org/ticket/15487

So, in firefox preferences>Advanced> uncheck "Use smooth scrolling".

Alex Pi
  • 816
  • 4
  • 12
  • 28