Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Datos de flexgrip

Estas en el tema de Datos de flexgrip en el foro de Frameworks JS en Foros del Web. Estimados: Alguien me puede ayudar? tengo un flexgrip de ajax y a persar de que los querys que estan involucreador entregar la informacion colicitada, no ...
  #1 (permalink)  
Antiguo 28/03/2011, 12:52
 
Fecha de Ingreso: marzo-2011
Mensajes: 2
Antigüedad: 13 años, 1 mes
Puntos: 0
Exclamación Datos de flexgrip

Estimados:


Alguien me puede ayudar? tengo un flexgrip de ajax y a persar de que los querys que estan involucreador entregar la informacion colicitada, no muestra en la grilla esta informacion, estpos son los codigo que estoy usando:

principal.php

<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Induccion a Ajax</title>
<script language="JavaScript" src="jquery/jquery-1.3.2.js"></script>
<script type="text/javascript" src="jquery/flexigrid.js"></script>
<link rel="stylesheet" type="text/css" href="jquery/css/flexigrid/flexigrid.css"></link>
<script type="text/javascript">
function VerMsg(){
var txt=$("#id_nombre").val();
alert(txt);
}
function seleccionado(){
var txt=$("#select1").val();
alert("Id Seleccionado\n"+txt);
}



function BuscaInfo(){
var url = 'busca_dato.php?nombre='+$("#id_nombre").val();
alert(url)
$("#panel2").flexigrid({
url: url,
dataType: 'json',
colModel : [
{display: 'ID CHOFER', name : 'chof.id_chofer', width : 40, sortable : true, align: 'center'},
{display: 'Rut', name : 'chof.rut', width : 180, sortable : true, align: 'left'},
{display: 'Nombre', name : 'chof.nombre', width : 120, sortable : true, align: 'left'},
{display: 'Direccion', name : 'chof.direccion', width : 130, sortable : true, align: 'left'},
{display: 'Comuna', name : 'chof.comuna', width : 80, sortable : true, align: 'right'},
{display: 'Telefono', name : 'chof.telefono', width : 80, sortable : true, align: 'right'}
],
searchitems : [
{display: 'ID Chofer', name : 'chof.id_chofer', isdefault: true}
//,{display: 'Proveedor', name : 'oc_cri.proveedor' }
],

sortname: "chof.id_chofer",
sortorder: "asc",
usepager: true,
useRp: true,
rp: 10,
showTableToggleBtn: true,
width: 700,
height: 200
});
}

function Mostrar(){
$(".Panel").slideDown("normal");

}
function Ocultar(){
$("#panel2").slideUp("fast");

}
</script>
<style type="text/css">
.Panel {
font-family: Arial, Helvetica, sans-serif;
font-size: 20px;
color: #083077;
}
</style>
</head>
<body>
<br /><br />
Ingrese Nombre
<input type="text" id="id_nombre" name="id_nombre" value="" />
<input type="button" value="Saludar" onclick="VerMsg()" name="btn" />

<br /><br />
<div id="panel" class="Panel">
Esto es un ejemplo.
<br />
Panel 1.
<br />
</div>
<div id="panel2" class="Panel">
</div>
<div id="panel3" class="Panel">
Esto es un ejemplo.
<br />
Panel 3.
<br />
</div>
<br></br>
<select name="select1" onchange="seleccionado()" id="select1">
<option value="0" >Seleccione ...</option>
<option value="Uno" >Primero</option>
<option value="Dos" >Segundo</option>
<option value="Tres" >Tercero</option>
<option value="Cuatro">Cuarto </option>
</select>
<br></br>
<input type="button" value="Mostrar" onclick="Mostrar()" name="btn2" />
<input type="button" value="Ocultar" onclick="Ocultar()" name="btn3" />
<input type="button" value="Buscar Info" onclick="BuscaInfo()" name="btn4" />



</body>
</html>


************************************************** **********
************************************************** **********

Busca_dato.php




<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
include "conexion.php";
$nombre=$_REQUEST[nombre];

function countRec($fname,$tname,$name) {
$sqlCR="select count($fname) as cant from $tname where nombre containing '$name' ";
$resultCR = ibase_query($sqlCR);
$rowCR = ibase_fetch_object($resultCR);
return $rowCR->CANT;
}

$page = $_POST['page'];
$rp = $_POST['rp'];
$sortname = $_POST['sortname'];
$sortorder = $_POST['sortorder'];

if (!$sortname) $sortname = 'nombre';
if (!$sortorder) $sortorder = 'desc';

$sort = "ORDER BY $sortname $sortorder";

if (!$page) $page = 1;
if (!$rp) $rp = 10;

$start = (($page-1) * $rp);

$limit = "first $rp skip $start";

$total=countRec('id_chofer','choferes',$nombre);

$sql="select $limit
id_chofer,
rut,
nombre,
direccion,
comuna,
telefono
from choferes
where nombre containing '$nombre' $sort";
$Q=ibase_query($cnn,$sql);

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-type: text/x-json");

$json = "";
$json .= "{\n";
$json .= "page: $page,\n";
$json .= "total: $total,\n";
$json .= "rows: [";
$rc = false;
$cont=0;
$contador=0;

while($R=ibase_fetch_object($Q)){
$cont++;
if ($rc) $json .= ",";
//$link = "a";

$json .= "\n{";
$json .= "id:'".$R->ID_CHOFER."',";

$json .= "cell:['".addslashes($R->ID_CHOFER)."'";
$json .= ",'".addslashes($R->RUT)."'";
/*
$json .= ",'".addslashes($R->NOMBRE)."'";
$json .= ",'".addslashes($R->DIRECCION)."'";
$json .= ",'".addslashes($R->COMUNA)."'";
*/
$json .= ",'".addslashes($R->TELEFONO)."' ]";
$json .= "}";
$rc = true;

/*---------*/

/*
$json .= "\n{";
$json .= "id:'".$R->ID_CHOFER."',";

$json .= "cell:['".addslashes($R->ID_CHOFER)."'";
$json .= ",'".addslashes($R->RUT)."'";
$json .= ",'".addslashes($R->NOMBRE)."'";
$json .= ",'".addslashes($R->DIRECCION)."'";
$json .= ",'".addslashes($R->COMUNA)."'";
$json .= ",'".addslashes($R->TELEFONO)."' ]";
$json .= "}";
$rc = true;
*/


}

$json .= "]\n";
$json .= "}";

//echo "<pre>";
echo $json;
//echo "</pre>";





//echo "<br /><br />Resultado Busqueda: $cantidad <br />
//
//<table width=\"500\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" bordercolor=\"#CCCCCC\" >
//<tr bgcolor=\"#ECF2FF\" >
// <td class=\"titulos\">Id Chofer</td>
// <td class=\"titulos\">Nombre Chofer</td>
//</tr>";
//
//while($R=ibase_fetch_object($Q)){
//
// echo "<tr bgcolor=\"#EEEEEE\" >
// <td class=\"letras\"> $R->ID_CHOFER</td>
// <td class=\"letras\"> $R->NOMBRE </td>
// </tr>";
//}
//
//echo "</table>";
//
//echo "<br /><br /><br />";

?>


¿alguien me puede ayudar ?

Atte.
Mauricio Serrano

Última edición por mserranoz; 31/03/2011 a las 05:53

Etiquetas: ajax, flexgrip, jquery, php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:11.