Question

i am new to dojo,..struggling alot in this please help.....

i am using the filter plugin in EnhancedGrid in dojo....i am doing great at client side but coming to server side i dont know how to call the servlet and get the filtered rows in to grid please help in this .....

i tried something like this....

           grid = new EnhancedGrid({
                id : 'grid',
                store : yourStore,
                structure : layout,
                rowSelector : '20px',
                plugins : {
                            search : true,
                            pagination : {
                                pageSizes : [ "50", "100"],
                                description : true,
                                sizeSwitch : true,
                                pageStepper : true,
                                gotoButton : true,
                                maxPageStep : 2,
                                position : "bottom"

                            },
                            filter : {

                                closeFilterbarButton : true,
                                ruleCount : 5,
                                ruleCountToConfirmClearFilter:2,
                                itemsName : "rows",
                                isServerSide:true,
                                isSateful:true,
                                url:"http:myaddress:8080/GridExample/Filter",
                                setupFilterQuery: setupFilter



                            }
                        }
                    });


                var setupFilter = function(commands, request){

                        if(commands.filter && commands.enable){
                            // some filter is defined and valid. You can modify the request object here.
                          }else{
                            // no filter is valid.
                          }
                        };
                    grid.placeAt("myGrid");
                    grid.startup();

                }
            });
Was it helpful?

Solution

First : have you load the Plugin correct?

   dojo.require("dojox.grid.enhanced.plugins.Filter");

And maybe this helps you with your Problem:

http://dojotoolkit.org/reference-guide/1.8/dojox/grid/EnhancedGrid/plugins/Filter.html#introduction-to-server-side-filtering

Regards

UPDATE 1

Hi there! I have to dig a little into the width of the Web but lately i think i found the answer to your question how to define the filter.

 plugins: {
            filter: {
              isServerSide: true,
              setupFilterQuery: function(commands, request){
                if(commands.filter && commands.enable){
                     console.log(commands.filter);
                     request.query = {
                         "Name": "L*"
                                      }       
                }
               }
               itemsName:'songs',
               closeFilterbarButton: true,
               ruleCount: 8
              }
           }

I grab this from here: https://bitbucket.org/dojo/dojox/src/64328839903b/grid/tests/enhanced/test_enhanced_grid_filter.html

This example defines a filter that searches the store for all Names that begins with the letter "L". With the other supported Operators you can define your own filter.

http://dojotoolkit.org/reference-guide/1.9/dojox/grid/EnhancedGrid/plugins/Filter.html#supported-operators

Hope this helps you!

Regards

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