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 doesn't works
11/11/2008
07:43
Avatar
abraxas1985
Member
Members
Forum Posts: 6
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

Hi, sorry for my English!

I have this problem:

I using JQgrid + JSP + Servlet in this manner:

$('#submit').click(function(event) {
        cruiseId = $('#cruiseID').val();
 
        $("#list").jqGrid({
            url: 'DTSServlet?arg='+ cruiseId,
            datatype: 'json',
            colNames:['Prior No.','Booking Start','Booking End','Mkt Code','Agent ID', 'Agent Type', 'Pax Type', 'Plan Code' , 'Price ID'],
            colModel :[
            {name:'priorNo',index:'priorNo', width:60},
            {name:'startDt',index:'startDt', width:85},
            {name:'endDt',index:'endDt', width:85},
            {name:'mktCd',index:'mktCd', width:65},
            {name:'agentId',index:'agentId', width:60},
            {name:'agtType',index:'agtType', width:85},
            {name:'paxType',index:'paxType', width:70},
            {name:'planCd',index:'planCd', width:70},
            {name:'priceId',index:'priceId', width:60} 
            ],
            jsonReader: {
                root: "rows",
                page: "page",
                total: "total",
                records: "records",
                repeatitems: true,
                cell: "cell"
            },
            rowNum: 3,
            imgpath: 'themes/basic/images',
            pager: $('#pager'),
            viewrecords: true,
            caption: 'Pricing Cross Reference For Cruise: '
        }).navGrid('#pager',{edit:false,add:false,del:true});
    });
});

In the servlet I set the response with a JSONObject and I set the parameters for the jsonreader in this way:

total:2

page:1

records: 3

I create an array with 5 elements and I put inside the field rows in a JSON format.

Now, it display all 5 rows without paginating and not 3. Why it doesn't works?

11/11/2008
08:23
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Can you show the json output built in your servlet ?

11/11/2008
09:25
Avatar
abraxas1985
Member
Members
Forum Posts: 6
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

Sure!

{"total":"2","page":"1","records":"3","rows":[{"cell":[1,"","","*","*","*","HONEY","*","ARSPOSIALT"]},{"cell":[2,"","","*","*","*","TORATES","*","ARMONIAUKH"]},{"cell":[3,"","","ZAF","*","*","PROMOSA","*","PROMOSAAR4"]},{"cell":[4,"","","SWE","*","*","*","*","ARMSVE5"]},{"cell":[5,"","","AUT","*","*","*","*","ARPROMOAGO"]},{"cell":[6,"","","GER","*","*","*","*","ARFERRAG"]},{"cell":[7,"","","GBR","*","*","*","*","PROMOAUGUK"]},{"cell":[8,"","","AUS","*","*","*","*","ARMAUS1308"]}]}

11/11/2008
10:17
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

My json looks like :

{
total: "2",
page: "1",
records: "18",
rows :[
  {id: "11",cell:["11","ADMISTRACIÓN LEGAL Y FINANZAS"]},
  {id: "4",cell:["4","ASEGURADORA, ARREDADORA FINANCIERA Y OTROS AFINES"]},
  {id: "16",cell:["16","CAJA DE AHORRO, COOPERATIVA O AFINES"]},
  {id: "10",cell:["10","CENTROS EDUCATIVOS Y AFINES"]},
  {id: "2",cell:["2","COMERCIALIZADORA DE PRODUCTOS ELECTRÓDOMESTICOS, COMPUTACIÓN, MAN"]},
  {id: "1",cell:["1","EDITORIAL, VENTA DE LIBROS (MAYOR O DETAL) Y AFINES"]},
  {id: "14",cell:["14","EMPRESAS DE CONSULTORÍA, DESARROLLO DE SOFTWARE Y AFINES"]},
  {id: "17",cell:["17","EMPRESAS DE SERVICIOS EN GENERAL"]},
  {id: "15",cell:["15","FUNDACIÓN SIN FINES DE LUCRO"]},
  {id: "9",cell:["9","INMOBILIARIAS, ADMINISTRADORAS DE BIENES RAÍCES Y AFINES"]}
 ]
}

11/11/2008
13:56
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

The problem is that you should return exactly 3 record from the

server and not 5

Regards

Tony

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.

12/11/2008
04:09
Avatar
abraxas1985
Member
Members
Forum Posts: 6
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

In the YamilBracho's JSON example he sets records to 18 but he sets less element in the field rows.

This is now the JSON that I generate dinamically:

{"total":"17","page":"1","records":"68","rows":[{"cell":[32,"01/01/2004","01/01/2009","INT","PE0041","0","*","*","ZEROAR"]},{"cell":[1500,"01/01/2004","01/01/2009","KOR","*","*","*","*","AR08POAGEB"]},{"cell":[3000,"01/01/2004","01/01/2009","GER","*","*","*","*","AR08POAGEB"]},{"cell":[3500,"01/01/2000","01/01/2009","AUT","*","*","*","*","AR08POAGEB"]}]}

I set in the Jqgrid definition:

rowNum: 4

In the server I calculate the number of total pages by totalRecords taken by the query (68) divided by the number of row to view (4).

So i obtained 17 and I set this value on the field total.

Now I view 4 records in the JQgrid but the paging is not active ( there isn't any arrow active in the pager bar).

12/11/2008
07:26
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Very strange...

Let's do something. Please return the json sample that I use and adjust your colModel accordinly...

Just to test...

13/11/2008
06:29
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

In your case you should set

{
total: “17″,
page: “1″,
records: “68″,

...

}

Regards

Tony

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:
41 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