0

我正在使用 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 如我所愿出现,但没有数据。

4

1 回答 1

0

我在您发布的代码或数据中看不到任何重要错误。该演示使用相同的代码(修改最少)和保存为文件的相同数据,一切正常。我建议您使用loadError回调(请参阅答案)来查看更多信息,您遇到了哪种错误。

于 2013-07-05T10:29:28.367 回答