简体   繁体   中英

Jqgrid don't show data

I'm using jqgrid to show data from a database, I have this HTML file:

<script type="text/javascript"> 
    jQuery().ready(function (){jQuery("#tblclientes").jqGrid({
url: "category.php",
    datatype: "xml",
mtype: "GET",
    colNames: ["ID", "Categorias Es", "Categorias En", "Categorias Ru"],
    colModel: [
        { name: "idCategoria", width: 55 },
        { name: "nomCategoriaEs", width: 200 },
        { name: "nomCategoriaEn", width: 200, align: "right" },
        { name: "nomCategoriaRu", width: 200, align: "right" },
    ],
pager: jQuery("#paginacion"),
rowNum:10, 
rowList:[10,20,30],      
sortname: "idCategoria",         
sortorder: "desc", 
viewrecords: true,
gridview: true,
    autoencode: true,
caption:"XML Example" }).navGrid('#paginacion',{edit:false,add:false,del:false});
}); 
</script> 

And this is my XML file created by the PHP file:

<?xml version='1.0' encoding='utf-8'?><rows><page>1</page><total>2</total><records>13</records><row id="1"><cell>1</cell><cell>Coke Drums</cell><cell>Coke Drums</cell><cell>Коксовые камеры</cell></row><row id="2"><cell>2</cell><cell>Columnas</cell><cell>Columns</cell><cell>Колонны</cell></row><row id="3"><cell>3</cell><cell>Reactores</cell><cell>Reactors</cell><cell>Реакторы</cell></row><row id="4"><cell>4</cell><cell>Intercambiadores de Calor</cell><cell>Heat Exchangers</cell><cell>Теплообменное оборудование</cell></row><row id="5"><cell>5</cell><cell>Autoclaves</cell><cell>Autoclaves</cell><cell>Автоклавы</cell></row><row id="6"><cell>6</cell><cell>Separadores</cell><cell>Separators</cell><cell>Сепараторы</cell></row><row id="7"><cell>7</cell><cell>Drums</cell><cell>Drums</cell><cell>Баки для нефтепродуктов</cell></row><row id="8"><cell>8</cell><cell>Módulos / Skid</cell><cell>Process Modules / Skid</cell><cell>Технологические модули, модульные основания</cell></row><row id="9"><cell>9</cell><cell>Tanques</cell><cell>Storage Tanks</cell><cell>Резервуары для хранения нефтепродуктов</cell></row><row id="10"><cell>10</cell><cell>Fundaciones OWF</cell><cell>OWF Fundations</cell><cell>Фундаменты для ветровых энергоустановок</cell></row></rows>

The Jqgrid appears as I want, but without data.

I don't see any important errors in the code or in the data which you posted. The demo uses the same code (with minimal modifications) and the same data saved as file and all works. I would recommend you to use loadError callback (see the answer ) to see more information which kind of error you have.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM