paginationdojoselection

Dojo 1.6.1 Selection + Paging does not clear the selection


I faced a problem with my dojo 1.6.1 EnhancedGrid. I'm trying to use paging and single selection mode like this :

<div id="theId" data-dojo-type="dojox.grid.EnhancedGrid"
data-dojo-props="selectionMode:'single', plugins: { indirectSelection: true,  pagination: {pageSizes: ['1'], description: true,sizeSwitch: true,pageStepper: true, gotoButton: true, maxPageStep: 4, position: 'bottom'}}">

Everything goes fine except when I select a row and then click on next page button the selection remains while the objects has changed. I have to do a dirty hack to fix this :

                    /**Let's hack it a bit **/
                grid.pagination.plugin.nextPageHook = grid.pagination.plugin.nextPage;
                grid.pagination.plugin.nextPage = function(src) {
                        this.grid.selection.select(-1);
                    this.nextPageHook();
                };

This guy does his jobb.

And the seccond problem is that I am not able to set default items number it's always 25. No matter which number I pass to the plugin parameters with defaultPageSize. And even more, there is no such field in the object grid.pagination.plugin . But still I can hack it like this :

                grid.pagination.plugin.pageSize = 1;
                grid.startup();

I hope I'm missing some thing and you can help me find out what. Thanks.


Solution

  • Sadly, it is a famous problem with Datagrid, it is kinda related to this also : http://bugs.dojotoolkit.org/ticket/13432

    For the number of rows, you have to use rowsPerPage (or rowPerPage don't remember exactly) property

    Also make sure the correct headers are sent in the request (range, start count, etc)