Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Problem with Add, Edit, Del, Search not working
28/11/2013
20:30
Avatar
loose
New Member
Members
Forum Posts: 1
Member Since:
28/11/2013
sp_UserOfflineSmall Offline

I'm having some problems with Inline Navigator feature, when I try to add, edit, del, search, nothing happens, the grid just say loading, refresh and the record dont change.

[Image Can Not Be Found]

My Code:

index.php

<html>
<head>
    <title>Municipios</title>
    <link rel="stylesheet" type="text/css" media="screen" href="css/humanity/jquery-ui-1.10.3.custom.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
    
    <script src="js/jquery-1.9.0.min.js" type="text/javascript"></script>
    <script src="js/i18n/grid.locale-pt-br.js" type="text/javascript"></script>
    <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
    

</head>

<body>

<table id="list2"></table>
<div id="pager2"></div>
<br />

    <script src="scriptgrid.js" type="text/javascript"></script>

</body>
</html>

gridquery.php

<?php
$dbhost='xxxx';
$dbuser='xxxx';
$dbpassword='xxxx';
$database='xxxx';

$page = $_GET['page']; // get the requested page
$limit = $_GET['rows']; // get how many rows we want to have into the grid
$sidx = $_GET['sidx']; // get index row - i.e. user click to sort
$sord = $_GET['sord']; // get the direction
if(!$sidx) $sidx =1;
// conectar no database
$db = mysql_connect($dbhost, $dbuser, $dbpassword)
or die("Connection Error: " . mysql_error());

mysql_select_db($database) or die("Erro ao conectar ao DB.");
$result = mysql_query("SELECT COUNT(*) AS count FROM municipios_ibge"); //count para saber numero elementos a serem impressos
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];

if( $count > 0 ) {
    $total_pages = ceil($count/$limit);
} else {
    $total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit; // do not put $limit*($page - 1)
$SQL = "SELECT * FROM municipios_ibge ORDER BY $sidx $sord LIMIT $start , $limit";
$result = mysql_query( $SQL ) or die("Não foi possível executar a query.".mysql_error());

$responce = new StdClass;
$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;
$i=0;
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
     $responce->rows[$i]['id']=$row['codigo'];
    $responce->rows[$i]['cell']=array($row['codigo'],$row['municipio'],$row['uf']);
    $i++;
}        
echo json_encode($responce);

?>

scriptgrid.js

jQuery("#list2").jqGrid({
       url:'gridquery.php?q=2',
    datatype: "json",
       colNames:['Codigo','Municipio', 'UF'],
    colModel:[
    {name:'codigo',index:'codigo', width:150, editable:true},
    {name:'municipio',index:'municipio', width:500, editable:true},
    {name:'uf',index:'uf', width:70, editable:true},
    ],
       rowNum:10,
       rowList:[10,20,30],
       pager: '#pager2',
       sortname: 'codigo',
    height: 'auto',
    width:'auto',
    viewrecords: true,
    sortorder: "desc",
    editurl: "gridquery.php",
    caption:"Lista Municipios"
});
jQuery("#list2").jqGrid('navGrid','#pager2',{edit:true,add:true,del:true});
jQuery("#list2").jqGrid('inlineNav',"#list2");

Whats its the problem ?

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
53 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information