Skip to content

Instantly share code, notes, and snippets.

@revirth
Last active August 29, 2015 13:56
Show Gist options
  • Save revirth/9107826 to your computer and use it in GitHub Desktop.
Save revirth/9107826 to your computer and use it in GitHub Desktop.
[JS.jqGrid] avoid insert greater number than total page's
//
// jquery.jqGrid.src.js
//
//
// setPager = function (pgid, tp){
// ...................
// ............
// .....
$('input.ui-pg-input',"#"+pgcnt).keypress( function(e) {
var key = e.charCode || e.keyCode || 0;
if(key === 13) {
if(!clearVals('user')) { return false; }
$(this).val( intNum( $(this).val(), 1));
ts.p.page = ($(this).val()>0) ? $(this).val():ts.p.page;
// just change number to totalpage
ts.p.page = ts.p.page > ts.p.lastpage ? ts.p.lastpage : ts.p.page;
populate();
return false;
}
return this;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment