Forum


18:06

30/05/2011

Hello,
please excuse my English, I'm French and I use a translator.
I have a problem with navigator search.
When I click on the icon 'search', window 'search' opens and I can take my data to my research.
But when I click the Find button, nothing happens. The window 'search' remains open but nothing else, the rows of the grid correspond to all rows of my database.
This is my code :
HTML :
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Back office - immovu.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" media="screen" href="css/bo_style.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/excite-bike/jquery-ui-1.8.13.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
</head>
<body>
<?php include('inc_top_menu.php');?>
<div id="content">
<table id="list"><tr><td/></tr></table>
<div id="pager"></div>
<!--<input type="BUTTON" id="bedata" value="Editer" />-->
<input type="BUTTON" id="bddata" value="Supprimer" />
</div>
<script src="js/jquery-1.6.1.js" type="text/javascript"></script>
<script src="js/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="js/list.js" type="text/javascript"></script>
</body>
</html>
Javascript :
url:'server.php',
datatype: 'xml',
mtype: 'POST',
colNames:['Inv No','Date', 'Amount','Tax','Total','Notes'],
colModel :[
{name:'invid', index:'invid', width:55},
{name:'invdate', index:'invdate', width:90, editable:true},
{name:'amount', index:'amount', width:80, align:'right', editable:true},
{name:'tax', index:'tax', width:80, align:'right', editable:true},
{name:'total', index:'total', width:80, align:'right', editable:true},
{name:'note', index:'note', width:150, sortable:false, editable:true}
],
pager: '#pager',
editurl: 'server.php',
rowNum:50,
rowList:[50,100,150],
sortname: 'invid',
sortorder: 'asc',
viewrecords: true,
gridview: true,
width: 1000, // largeur
height: "100%", // hauteur
caption: 'Invheader :'
});
jQuery("#list").jqGrid('navGrid',"#pager",{add:false, del:false, edit:false, view:true},
{}, // edit
{}, // add
{}, // del
{multipleSearch: true}, // search
{} // view
);
And, PHP :
include("dbconfig.php");
$page = $_POST['page'];
$limit = $_POST['rows'];
$sidx = $_POST['sidx'];
$sord = $_POST['sord'];
// if we not pass at first time index use the first column for the index or what you want
if(!$sidx) $sidx =1;
// connect to the MySQL database server
$db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());
// select the database
mysql_select_db($database) or die("Error connecting to db.");
// calculate the number of rows for the query. We need this for paging the result
$result = mysql_query("SELECT COUNT(*) AS count FROM invheader");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];
// calculate the total pages for the query
if( $count > 0 && $limit > 0) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
// if for some reasons the requested page is greater than the total
// set the requested page to total page
if ($page > $total_pages) $page=$total_pages;
// calculate the starting position of the rows
$start = $limit*$page - $limit;
// if for some reasons start position is negative set it to 0
// typical case is that the user type 0 for the requested page
if($start <0) $start = 0;
// the actual query for the grid data
$SQL = "SELECT invid, invdate, amount, tax, total, note FROM invheader ORDER BY $sidx $sord LIMIT $start , $limit";
$result = mysql_query( $SQL ) or die("Couldn't execute query.".mysql_error());
// we should set the appropriate header information. Do not forget this.
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>".$page."</page>";
$s .= "<total>".$total_pages."</total>";
$s .= "<records>".$count."</records>";
// be sure to put text data in CDATA
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$s .= "<row id='". $row['invid']."'>";
$s .= "<cell>". $row['invid']."</cell>";
$s .= "<cell>". $row['invdate']."</cell>";
$s .= "<cell>". $row['amount']."</cell>";
$s .= "<cell>". $row['tax']."</cell>";
$s .= "<cell>". $row['total']."</cell>";
$s .= "<cell><![CDATA[". $row['note']."]]></cell>";
$s .= "</row>";
}
$s .= "</rows>";
echo $s;
?>
if you have an idea, let me know!
13:22

30/05/2011

Hello,
I am having same problem as Jiggazzzzs first problem, when I click the find button it returns all table records.
my code is:
javascript:
<?php // no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );?>
<?php
$myfirstgridpath=JURI::root().'modules/mod_Nderprerje/';
$document =& JFactory::getDocument();
$document->addStyleSheet($myfirstgridpath.'css/ui-lightness/jquery-ui-1.7.2.custom.css');
$document->addStyleSheet($myfirstgridpath.'css/ui.jqgrid.css');
$document->addScript($myfirstgridpath.'js/jquery-1.4.2.min.js');
$document->addScript($myfirstgridpath.'js/i18n/grid.locale-en.js');
$document->addScript($myfirstgridpath.'js/jquery.jqGrid.min.js');
?>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'<?php echo $myfirstgridpath.'/datasource.php';?>',
datatype: "xml",
mtype:'GET',
colNames:['ID','Emri','Kontrata', 'Data', 'Debia','Tipi','Zona'],
colModel:[{name:'ID',index:'ID', width:50},
{name:'EMER_DEBITORI',index:'EMER_DEBITORI', width:100},
{name:'NR_CONT',index:'NR_CONT', width:60},
{name:'Joomla_Date_Shkeputje',index:'Joomla_Date_Shkeputje', width:110},
{name:'DEBIA_TOTALE',index:'DEBIA_TOTALE', width:80, align:"right"},
{name:'TIP_DESC',index:'TIP_DESC', width:70, align:"right"},
{name:'EMER_ZONE',index:'EMER_ZONE', width:80,align:"right"}],
rowNum:10,
loadonce:false,
autowidth:true,
rowList:[10,20,30,100],
pager: jQuery('#pager'),
sortname: 'ID',
viewrecords: true,
sortorder: "ASC",
caption:"Lista e Debitoreve te nderprere",
loadtext:"Ne kerkim, ju lutem prisni",
toolbar:[true,"top"]
});
jQuery("#list").jqGrid('navGrid','#pager',{edit:false,add:false,del:false});
});
</script>
<table id="list" class="search"></table>
<div id="pager" class="search" style="text-align:center;"></div>
and PHP:
<?php
//defined('_JEXEC',1) or die('Restricted access');
//defined( '_VALID_MOS' ) or die( 'Restricted access' );
//$host = trim( $params->get( 'host' ) );
//$database = trim( $params->get( 'database' ) );
//$user = trim( $params->get( 'user' ) );
//$password = trim( $params->get( 'password' ) );
$host = 'host';
$user = 'xxxxxx';
$password = 'xxxxx';
$database = 'xxxxxx';
$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;
//connect to the database
$db = mssql_connect($host, $user, $password) or die("Connection Error: " . mssql_error());
mssql_select_db($database) or die("Error conecting to db.");
$result = mssql_query("SELECT COUNT(*) AS count FROM [Joomla].[dbo].[DEBITOR_TE_SHKEPUTUR]");
$row = mssql_fetch_array($result,MSSQL_ASSOC);
$count = $row['count'];
$plus1='1';
if( $count >0 ) {
$totalpages = ceil($count/$limit);
} else {
$totalpages = 0;
}
if ($page > $totalpages) $page=$totalpages;
$start = ($limit*$page - $limit);
$start1=$start+$plus1;
$next=$start+$limit; // do not put $limit*($page - 1)
$SQL = "SELECT * FROM (SELECT row_number() OVER (ORDER BY ".$sidx." ".$sord.") AS rownum ,ID,[EMER_DEBITORI],[NR_CONT] ,[Joomla_Date_Shkeputje],[DEBIA_TOTALE],[TIP_DESC],[EMER_ZONE] FROM [Joomla].[dbo].[DEBITOR_TE_SHKEPUTUR]) AS A
WHERE A.rownum BETWEEN ".$start1." and ".$next;
$result = mssql_query( $SQL ) or die("Couldn t execute query.".mssql_error());
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");
}
$et = ">";
echo "<?xml version='1.0' encoding='utf-8'?$et\n";
echo "<rows>";
echo "<page>".$page."</page>";
echo "<total>".$totalpages."</total>";
echo "<records>".$count."</records>";
// be sure to put text data in CDATA
while($row = mssql_fetch_array($result,MSSQL_ASSOC)) {
echo "<row id='". $row[ID]."'>";
echo "<cell>". $row[ID]."</cell>";
echo "<cell>". $row[EMER_DEBITORI]."</cell>";
echo "<cell>". $row[NR_CONT]."</cell>";
//echo "<cell>". $row[name]."</cell>";
// echo "<cell><![CDATA[". $row[Joomla_Date_Shkeputje]."]]></cell>";
echo "<cell>". $row[Joomla_Date_Shkeputje]."</cell>";
echo "<cell>". $row[DEBIA_TOTALE]."</cell>";
echo "<cell>". $row[TIP_DESC]."</cell>";
echo "<cell>". $row[EMER_ZONE]."</cell>";
// echo "<cell>". $row[note]."</cell>";
// echo "<cell><![CDATA[". $row[note]."]]></cell>";
echo "</row>";
}
echo "</rows>";
mssql_close($db)
?>
I can't find the problem, pleas a help will be great
Most Users Ever Online: 715
Currently Online:
54 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66