[jQuery] url serialize or getUrlParam

2008-09-09 Thread drlinux

Hello,
I want to get lastest url paramaters and add this paramater another
url like that:
http://blabla.com/action.php?q=1&page=1&rows=50&sidx=id
to
http://blabla.com/action.php?q=5&page=1&rows=50&sidx=id

I tried out getUrlParam but it doesn't work with jqgrid.
Thanks a lot.
King Regards,
Ibrahim
PS: You can see the code below:

http://dpaste.com/76882/


[jQuery] jqgrid + json search example

2008-09-04 Thread drlinux

Hi boys,
I'm trying to code some app. with jquery and jqgrid. Most of the app.
is finished except search function. I can't get the datas from server
when I want to search in my grids.
Can anyone help me?
Many thanks
King Regards
Ibrahim.
Ps: I read the documentation. But i think i've problems with my JSON
data. Who can explain me?
My js file:
Code:

jQuery(document).ready(function(){

function pickdates(id){

   jQuery("#"+id+"_tarih","#rowed3").datepicker({dateFormat:"yy-mm-
dd"});}

var lastsel;

jQuery("#rowed3").jqGrid({

  url:'get.php',

   datatype: "json",

  colNames:['Id','Havuz','Tarih', 'Giren',
'Çıkan','Ortalama','Açıklama'],

  colModel:[

 {name:'id',index:'id', width:40, align:"center"},

 {name:'havuz',index:'havuz', width:90, align:"center",
editable:true},

 {name:'tarih',index:'tarih', width:90, align:"center",
editable:true, sorttype:"date"},

 {name:'giren',index:'giren', width:90, align:"center",
editable:true},

 {name:'cikan',index:'cikan', width:90, align:"center",
editable:true},

 {name:'ortalama',index:'ortalama', width:90,
align:"center"},

 {name:'aciklama',index:'aciklama', width:250, align:"center",
editable:true},

 ],

  rowNum:50,

  rowList:[50,100,150],

  imgpath: 'themes/sand/images',

  pager: jQuery('#prowed3'),

  sortname: 'id',

viewrecords: true,

sortorder: "desc",

   height: 363,

width:800,

   caption: "Balık Hareket Tablosu Düzenleme"

}).navGrid('#prowed3', {}, //options

{editCaption: "Kayıt Düzenle", bSubmit: "Kaydet", bCancel: "Vazgeç",
processData: "Kaydediyor...", url:"duzenle.php", onInitializeForm:
function(formid) {



$("#tarih",formid).datepicker({dateFormat:"dd-mm-yy"});



}}, // edit options

{addCaption: "Kayıt Ekle", bSubmit: "Kaydet", bCancel: "Vazgeç",
processData: "Kaydediyor...", url:"ekle.php", onInitializeForm:
function(formid) {



$("#tarih",formid).datepicker({dateFormat:"dd-mm-yy"});



}}, // add options

{delCaption: "Kayıt Sil", bSubmit: "Evet", bCancel: "Hayır",
processData: "Siliniyor...", url:"sil.php",

msg:"Seçili Kaydın Silinmesini Onaylıyor musunuz?"}, // del options

{sopt:['cn','bw','eq','ne','lt','gt','ew'], url:"arama.php?q=1"} //
search options

);

});



My Json data file:

Code:

 ".$fldata;

} else {

   $wh .= " <> '".$fldata."'";

}

break;

 case "lt":

if(is_numeric($fldata)) {

   $wh .= " < ".$fldata;

} else {

   $wh .= " < '".$fldata."'";

}

break;

 case "le":

if(is_numeric($fldata)) {

   $wh .= " <= ".$fldata;

} else {

   $wh .= " <= '".$fldata."'";

}

break;

 case "gt":

if(is_numeric($fldata)) {

   $wh .= " > ".$fldata;

} else {

   $wh .= " > '".$fldata."'";

}

break;

 case "ge":

if(is_numeric($fldata)) {

   $wh .= " >= ".$fldata;

} else {

   $wh .= " >= '".$fldata."'";

}

break;

 case "ew":

$wh .= " LIKE '%".$fldata."'";

break;

 case "ew":

$wh .= " LIKE '%".$fldata."%'";

break;

 default :

$wh = "";

  }

   }

}

//echo $fld." : ".$wh;

// connect to the database

$db = mysql_connect($dbhost, $dbuser, $dbpassword)

or die("Connection Error: " . mysql_error());



mysql_select_db($database) or die("Error conecting to db.");



switch ($examp) {

case 1:

  $result = mysql_query("SELECT COUNT(*) AS count, SUM(giren) AS
giren, SUM(cikan) AS cikan, SUM(ortalama) AS ortalama FROM
balik_hareket ".$wh);

  $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)

if ($start<0) $start = 0;

$SQL = "SELECT * FROM balik_hareket".$wh." ORDER BY ".$sidx."
". $sord." LIMIT ".$start." , ".$limit;

  $result = mysql_query( $SQL ) or die("Couldnt execute
query.".mysql_error());

  $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[id];

$responce->rows[$i]['cell']=array($row[id],$row[havuz],$row[tarih],
$row[giren],$row[cikan],$row[ortalama],$row[aciklama]);

$i++;

}

echo json_encode($responce);



break;

case 2:

  $result = mysql_query("SELECT COUNT(*) AS count FROM
balik_hareket".$wh);

  $row = mysql_fetch_array($result,MYSQL_ASSOC);

  $count