jqgrid没有在服务器acugis中加载数据,而是在本地运行,一切都很完美

jqgrid not loading data in server acugis but locally all works perfect

本文关键字:运行 完美 acugis 服务器 加载 jqgrid 数据      更新时间:2023-09-26

你好,我的jqgrid遇到了问题,我的jqgrid在本地加载了一个xml文件(在本地所有工作),但在服务器中没有加载任何东西,我尝试了在互联网上找到的每一个代码,但我不知道为什么它没有在网格中加载数据,jqgrid总是显示一条消息,上面写着loading。。。我等了一段时间,然后它停了下来,没有装载任何东西,有人能帮忙吗??本地工作,但在服务器acugis不是,请帮助

这是我的代码:

$("#listaRedCuidadana").jqGrid({
            treeGrid: true,
            treeGridModel : 'adjacency',
            ExpandColumn : 'distrito',
            url: '../../red_ciudadana/controller/controllerMostrarRedCuidadana.php',
            treeReader: {
                level_field: 'level',
                parent_id_field: 'parent_id',
                leaf_field: 'isLeaf',
                expanded_field: 'expanded'
            },
            datatype: "xml",
            mtype: "POST",
            colNames:["id_ciudadano","Distrito","Seccion","Rol","Clave Electoral","Nombre","Apellido Paterno","Apellido Materno"],
            colModel:[
                 {name:'id_ciudadano',index:'id_ciudadano', width:1,hidden:true,key:true},
                 {name:'distrito',index:'distrito',align:"left"},
                 {name:'seccion',index:'seccion', width:60,align:"center"},
                 {name:'rol',index:'rol', width:150,align:"left"},
                 {name:'clave_electoral',index:'clave_electoral', width:150,align:"center"},
                 {name:'nombre',index:'nombre', width:100,align:"left"},
                 {name:'apaterno',index:'apaterno', width:100,align:"left"},
                 {name:'amaterno',index:'amaterno', width:100,align:"left"}
            ],
            width:'916',
            /*autowidth:true,*/
            height:'auto', 
            pager: '#pager',
            caption:"COORDINADORES DISTRITALES",
            onSelectRow: function(id){
                var clv=$('#listaRedCuidadana').jqGrid('getCell',id,4);
                mostrarDetallesCuidadano(clv);
                initMapa();
            }
        });
        $("#listaRedCuidadana").jqGrid('navGrid',"#pager",{edit:false,add:false,del:false});

和我的.php文件

<?php
require_once '../../sesion/model/clsSesion.php';
require_once '../../red_ciudadana/model/modelRedCuidadana.php';
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
        header("Content-type: application/xhtml+xml;charset=utf-8"); } else {
        header("Content-type: text/xml;charset=utf-8");
}
if(isset($_REQUEST['nodeid'])==FALSE) {
    $node =0;
}
else{
    $node = (integer)$_REQUEST["nodeid"];
}
$clsJqGrid = new redCuidadana();
$et = ">";
echo "<?xml version='1.0' encoding='utf-8'?$et'n";
echo "<rows>";
echo "<page>1</page>";
echo "<total>1</total>";
echo "<records>1</records>";
if($node >0) { //check to see which node to load
   $wh = 'parent_id='.$node; // parents
   //$n_lvl = $n_lvl+1; // we should ouput next level
} else {
   //$wh = 'ISNULL(parent_id)'; 
   $wh ='parent_id=0';// roots
}
$mostrarRegistros= $clsJqGrid->mostrarRegistros($wh);
foreach ($mostrarRegistros as $row){
   echo "<row>";         
   echo "<cell>".$row["id_ciudadano"]."</cell>";
   echo "<cell>".$row["distrito"]."</cell>";
   echo "<cell>".$row["seccion"]."</cell>";
   echo "<cell>".$row["rol"]."</cell>";
   echo "<cell>".$row["clave_electoral"]."</cell>";
   echo "<cell>".$row["nombre"]."</cell>";
   echo "<cell>".$row["apaterno"]."</cell>";
   echo "<cell>".$row["amaterno"]."</cell>";
   echo "<cell>".$row["level"]."</cell>";
   echo "<cell><![CDATA[".$row["parent_id"]."]]></cell>";
   if($row["level"] == "2"){echo "<cell>"."true"."</cell>";}
   else{echo "<cell>".$row["isLeaf"]."</cell>";}
   echo "<cell>".$row["expanded"]."</cell>";
   echo "</row>";
}
echo "</rows>";
?>

1.尝试在不执行任何逻辑的情况下从php中简单地回显示例xml,并查看JS脚本是否接收到它;

2.如前所述,尝试直接在浏览器中访问PHP脚本,看看它是否返回有效结果;

3.尝试在chrome中调试代码(不仅在ff:firebug中),这两个工具都很好,有时chrome可以显示ff遗漏了什么(反之亦然)。

这些步骤将帮助您隔离并发现问题。如果您检查了上面的所有项目符号,但问题仍然存在,请在主题中提供结果,这样我们将有机会帮助您。

干杯,祝你好运;)