Forum


04:56

16/06/2010

Hi,
Im a newbie. Following the documentation I tried to use jQuery Grid without connecting to the DB. I send the data using JSON and It seems to be ok at the Body Layer except that at the middle apears a label with an undefined text inside it and the Navigation Layer doesn't seems to work. My servlet code is:
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/json;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.print("{"
+ ""total": "2",\n"
+ ""page": "1",\n"
+ ""records": "12",\n"
+ ""datos" : [\n"
+ "{"id" : "1", "cell" : ["1", "Josefina Villegas", "27"]},\n"
+ "{"id" : "2", "cell" : ["2", "Mario Miki", "30"]},\n"
+ "{"id" : "3", "cell" : ["3", "Eloisa Avila", "28"]},\n"
+ "{"id" : "4", "cell" : ["4", "Erandi Urban", "26"]},\n"
+ "{"id" : "5", "cell" : ["5", "Ivan Ortega", "26"]},\n"
+ "{"id" : "6", "cell" : ["6", "Rodrigo Avila", "30"]},\n"
+ "{"id" : "7", "cell" : ["7", "Carlos Miki", "28"]},\n"
+ "{"id" : "8", "cell" : ["8", "Roberto Miki", "30"]},\n"
+ "{"id" : "9", "cell" : ["9", "Rogelio Navarrete", "28"]},\n"
+ "{"id" : "10", "cell" : ["10", "Sergio Prado", "26"]},\n"
+ "{"id" : "11", "cell" : ["11", "Cristina Amparan", "26"]},\n"
+ "{"id" : "12", "cell" : ["12", "Norma Barreiro", "30"]},\n"
+ "]\n"
+ "}");
} finally {
out.close();
}
}
The idea is to use the Navigator Layer to see the last two "rows", but the navigation layer doesn't appear. My js code is this:
<script type="text/javascript"> jQuery(document).ready(function(){
jQuery("#list").jqGrid({ url:'respuestaJSON', datatype: 'json', mtype: 'GET',
jsonReader : {root:"datos",page: "page",total: "total",records: "records"},
colNames:['id','Nombre', 'Edad'],
colModel :[ {name:'id', index:'id', width:55},
{name:'Nombre', index:'Nombre', width:150, align:'right'},
{name:'Edad', index:'Edad', width:80, align:'right'}],
pager: jQuery('#paginador'), rowNum:15, rowList:[10,20,30],sortname: 'id',
sortorder: "desc",
viewrecords: true,
caption: 'Primer prueba'
});
});
</script>
Any advice is welcome. Thanks in advance.
02:21

20/06/2010

Hola,
me parece que te hace falta agregar esto:
jQuery("#list1").jqGrid(
'navGrid',
'#paginador',
{add:false, edit:false,del:false});
Espero y te sirva.
Saludos.
P.D. me dices si te aparecen habilitados los botones para cambiar de página. (los mios están deshabilitados, ando buscando como habilitarlos)
Most Users Ever Online: 715
Currently Online:
61 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66