Dojo Enhanced grid with pagination need to access

2020-02-15 08:18发布

问题:

I am implementing Dojo EnhancedGrid with pagination and there is something called items per page.

10 | 20 | 30 | 40  | 50| all.

Suppose I select here 20 in the EnhancedGrid pagination. How to access the value 20 from the program? I want to get this value and store it in a variable say Page-size. I am using Dojo version 1.6.1

回答1:

You can access the page size in dojo 1.6 using this:

yourGrid.pagination.plugin.pageSize;

Here is a working jsfiddle using dojo 1.6:

http://jsfiddle.net/SM8GS/1/

It uses the onClick event of the grid. Each time you click on the grid it alerts the current page size.

Please edit your initial question & add the dojo version to it !

Lucian



回答2:

The documentation states that there is a currentPageSize() method. You can access it directly from the EnhancedGrid object. I made a JSFiddle to test this. At the bottom of the script you can find the following code:

// Display current page size
grid.on("RowClick", function() {
   alert(grid.currentPageSize());    
});

Change the pagesize and click any row to see the result.

The rest of the code is copy-pasted from the documentation just to get a simple example of the enhanced grid (no special tricks are involved).