Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Pagination always goes to 1 page
25/06/2014
00:23
Avatar
Raphael
New Member
Members
Forum Posts: 2
Member Since:
25/06/2014
sp_UserOfflineSmall Offline

Hi Support,

Could you please help me with this issue? I already have a server that does the pagination and it works for other projects with jqgrid (4.3), but with jqgrid 4.6.0 it is not working.

Please take a look in the code below: 

Obs.: In runtime I change the url and datatype to json and the request is always :

<server>?idSolicitacaoServico=&idStatusSolicitacao=1&dtIni=&dtFim=&idEntidadeGerenciada=&pagina=1&quantidadeRegistros=10&_search=false&nd=1403643699440&rows=10&page=1&sidx=&sord=asc&totalrows=10

pagina=1 and page never change even if I change the text box with the page number. I know I did some mistake, but I just can't find.

$("#search-results").jqGrid().setGridParam(
 {
    datatype:'json',
    url : '${pesquisarSolicitacao}',
    pagina : function() { return $('#search-results').getGridParam('page'); },
 }
 ).trigger("reloadGrid");

<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Portal do Incorporador</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,400italic,600italic,700italic' rel='stylesheet' type='text/css'> -->
<link rel="stylesheet" href="<c:url value="/resources/css/normalize.css"/>">
<link rel="stylesheet" href="<c:url value="/resources/css/ogfi-grid.css"/>">
<link rel="stylesheet" href="<c:url value="/resources/css/portal.css"/>">
<link rel="stylesheet" href="<c:url value="/resources/css/ogfi-theme/jquery-ui-1.10.4.custom.css"/>">
<link rel="stylesheet" href="<c:url value="/resources/css/ui.jqgrid.css"/>">
</head>

<body class="search-page">

<table id="search-results"></table>
<div id="search-results-pager"></div>

<script src="<c:url value="/resources/js/vendor/jquery-1.11.0.min.js"/>" type="text/javascript"></script>
<script src="<c:url value="/resources/js/vendor/jquery.nivo.slider.pack.js"/>" type="text/javascript"></script>
<script src="<c:url value="/resources/js/main.js"/>" type="text/javascript"></script>
<script src="<c:url value="/resources/js/vendor/jquery.chosen.min.js"/>" type="text/javascript"></script>
<script src="<c:url value="/resources/js/vendor/jquery.ogfiaccordion.js"/>" type="text/javascript"></script>

<script src="<c:url value="/resources/js/jquery-ui-1.10.4.min.js"/>" type="text/javascript"></script>
<script src="<c:url value="/resources/js/jqgrid/grid.locale-pt-br.js"/>" type="text/javascript"></script>

<!-- jqgrid min 4.6.0 -->
<script src="<c:url value="/resources/js/jqgrid/js/jquery.jqGrid.min.js"/>" type="text/javascript"></script>

<script type="text/javascript">

$(window).ready(function() {

// Loading jdGrid
var emptyRecords = '<spring:message code="solicitacaoServico.pesquisa.mensagem.nenhuma"/>';

$("#search-results").jqGrid({
autowidth: true,
datatype: 'local',
url:null,
mtype: 'POST',
colNames:[
'<spring:message code='solicitacaoServico.pesquisa.numero'/>',
'<spring:message code='solicitacaoServico.pesquisa.tabela.data'/>',
'<spring:message code='solicitacaoServico.entidade'/>',
'<spring:message code='solicitacaoServico.pesquisa.tabela.usuario'/>',
'<spring:message code='solicitacaoServico.pesquisa.tabela.tipoSol'/>',
'<spring:message code='solicitacaoServico.pesquisa.situacao'/>',
''
],
colModel:[
{ name:'idSolicitacao', index:'idSolicitacao',width:60, sortable: false },
{ name:'dataCriacao', index:'dataCriacao',width:60, sortable: false , formatter: 'date', formatoptions: {srcformat: 'U/1000', newformat:'${sessionScope.padraoDataGrid}' ,reformatAfterEdit : true}},
{ name:'entidade', jsonmap:'entidadeGerenciada.nomeEntidade', sortable: false ,width:200},
{ name:'usuario', jsonmap:'usuario.nome', sortable: false ,width:120},
{ name:'tipoSolicitacao', jsonmap:'tipoSolicitacao.nomeDominio', sortable: false ,width:150},
{ name:'situacao', jsonmap:'statusSolicitacao.nomeDominio', sortable: false ,width:80},
{ name:'detalhe', index : '', sortable: false , formatter : function() {
return "<a href='javascript:verDetalhes()'><img src='<c:url value="/resources/images/icon-detail.png" />'/></a>";
}
}
],
postData : {
idSolicitacaoServico : function() { return $("#numeroSolicitacao").val(); },
idStatusSolicitacao : function() { return $("#listaStatusSolicitacao").val(); },
dtIni: function() { return $("#dtIni").val(); },
dtFim: function() { return $("#dtFim").val(); },
idEntidadeGerenciada: function() { return $("#listaEntidade").val(); },
pagina : function() { return $('#search-results').getGridParam('page'); },
quantidadeRegistros : function() { return $("#search-results").getGridParam('rowNum'); }
},
rowNum:10,
rowList:[10,50,100],
rowTotal: 10,
pager: '#search-results-pager',
onPaging : function(but) {
alert($('#search-results').getGridParam('page'));
$("#search-results").trigger("reloadGrid");
},
viewrecords: true,
gridview: true,
hidegrid: false,
rownumbers: true,
emptyrecords: emptyRecords,
caption: '<spring:message code="solicitacaoServico.detalhe.titulo"/>',
jsonReader : {
root: "pageItems",
page: "pageNumber",
total: "pagesAvailable",
records: "totalItens",
repeatitems: false,
cell: "cell",
id: "idSolicitacao"
}
});

$("#search-results").jqGrid('navGrid','#search-results-pager',
{ edit:false, add:false, del:false, search:false, refresh:false}, {}, {}, {}, {}
);
});

</script>

</body>

 

this is the response from server:

{"pageNumber":1,"pagesAvailable":2,"totalItens":11,"pageItems":[{"... 10 itens"}]}

25/06/2014
18:24
Avatar
Raphael
New Member
Members
Forum Posts: 2
Member Since:
25/06/2014
sp_UserOfflineSmall Offline

Solved,

I added the code below, and after removing it, the grid start to page again. 

Thanks,

onPaging : function(but) {
alert($('#search-results').getGridParam('page'));
$("#search-results").trigger("reloadGrid");
},
08/07/2014
11:50
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Thanks for posting the solution.

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
35 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information