Jqgrid不显示数据

时间:2013-07-05 10:15:21

标签: php javascript jquery html jqgrid

我正在使用jqgrid来显示数据库中的数据,我有这个HTML文件:

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

这是我的PHP文件创建的XML文件:

<?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>

Jqgrid按我的意愿显示,但没有数据。

1 个答案:

答案 0 :(得分:0)

我发现代码或您发布的数据中没有任何重要错误。 The demo使用相同的代码(只需很少的修改),同样的数据保存为文件和所有工作。我建议您使用loadError回调(请参阅the answer)查看更多信息您遇到的错误。