PDA

View Full Version : [4.0.1] Paging toolbar items are inappropriately enabled when no data



neonova
25 May 2011, 7:36 AM
If a grid's store has not been loaded, the "next", "last", and "inputItem" items on the PagingToolbar are enabled by default. The "first" and "prev" items are correctly disabled.

The source of this problem is in /src/toolbar/Paging.js, in onLoad(), line #361

me.child('#inputItem').setValue(currPage);
me.child('#first').setDisabled(currPage === 1);
me.child('#prev').setDisabled(currPage === 1);
me.child('#next').setDisabled(currPage === pageCount);
me.child('#last').setDisabled(currPage === pageCount);
I was able to fix it locally by verifying that pageCount is a valid value:

me.child('#inputItem').setValue(currPage).setDisabled(!pageCount || pageCount === 1);
me.child('#first').setDisabled(currPage === 1);
me.child('#prev').setDisabled(currPage === 1);
me.child('#next').setDisabled(!pageCount || currPage === pageCount);
me.child('#last').setDisabled(!pageCount || currPage === pageCount);