php - jqGrid search not working -


here code. search not working , edit showing not saving in database! tried in url, http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3asinge_searching. couldn't correct up. how can fix problem?

<script type="text/javascript">     $(function(){         jquery("#list1").jqgrid({             url:'school_manager_db.php?q=1',             datatype: "xml",             colnames:['id','name', 'city', 'email','tel no','type','notes'],             colmodel:[                 {name:'id',index:'school_id', width:65,},                 {name:'name',index:'school_name', width:290,editable: true},                 {name:'city',index:'city', width:130,editable: true},                 {name:'email',index:'email', width:130,editable: true, align:"right"},                 {name:'tel',index:'contact', width:130,editable: true, align:"right"},                 {name:'type',index:'type', width:80,editable: true,edittype: 'select',                 align:"right"},                 {name:'note',index:'note', width:150,editable: true, sortable:false}             ],             height:480,             rownum:10,             rowlist:[40,80,120],             imgpath: '/images',             pager: jquery('#pager1'),             sortname: 'id',             viewrecords: true,             sortorder: "desc",             caption:'',             editurl:"someurl.php"         }).navgrid('#pager1',{             edit:true,             add:true,             del:true         });         jquery("#list1").searchgrid( options );     }); </script> 

my php page,

<?php     include("db.php");     $page = $_get['page']; // requested page.     $limit = $_get['rows']; // how many rows want have grid.     $sidx = $_get['sidx']; // index row - i.e. user click sort.     $sord = $_get['sord']; // direction.      if (!$sidx)          $sidx =1;      $result = mysql_query("select count(*) count school");     $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; // not put $limit*($page - 1).     $sql = "select school_id, school_name,school_bedge,city,contact, email,typ school order $sidx $sord limit $start , $limit";     $result = mysql_query( $sql ) or die("couldn?t execute query.".mysql_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>".$total_pages."</total>";     echo "<records>".$count."</records>";      // sure put text data in cdata.     while($row = mysql_fetch_array($result,mysql_assoc))     {         echo "<row id='". $row[id]."'>";         echo "<cell>". $row['school_id']."</cell>";         echo "<cell>". $row['school_name']."</cell>";         echo "<cell>".  $row['city']."</cell>";         echo "<cell>". $row['email']."</cell>";         echo "<cell>". $row['contact']."</cell>";         echo "<cell>". $row['typ']."</cell>";         echo "<cell><![cdata[". $row[note]."]]></cell>";         echo "</row>";     }     echo "</rows>"; ?> 

may problem in "type" column use edittype: select . try replacing following code :

{name:'type',index:'type', width:80,editable: true, search: false, edittype: 'select',                 align:"right"}, 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -