Question

I am new to Dojo, I am using QueryReadStore as the store for loading my TreeGrid, working fine. But the QueryReadStore appends some paramters to the url, parameters like parentId, count, sort etc., I have looked at this link http://dojotoolkit.org/reference-guide/1.7/dojox/data/QueryReadStore.html, but not able to understand.

Parameters are getting passed like this servlet/DataHandler?start=0&count=25

How to manipulate the parameters, like I want to set the value for parentId paramters so that I only get that particular row details.

Was it helpful?

Solution

In theory you wold have to create a new class by extending the "dojox.data.QueryReadStore", in the link you posted have an example for doing exactly what you want. See if you get it now(changed a bit):

    dojo.require("dojox.data.QueryReadStore");

    dojo.declare("custom.MyReadStore", dojox.data.QueryReadStore, {
      fetch:function(request){
        //append here your custom parameters:
         var qs = {p1:"This is parameter 1",
                   q:request.query.name
                  }
        request.serverQuery = qs;
        // Call superclasses' fetch
        return this.inherited("fetch", arguments);
      }
    });

So When come to create the QueryReadStore you actually create a object with the class you defined. something like this:

    var queryReadStore = new custom.MyReadStore({args...})

Explore the request parameter passed to the function to see what else you can do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top