public function executeStickyJson(sfWebRequest $request){ $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 $page_id = $_GET['page_id']; $catalogue_id = $_GET['catalogue_id']; $count = Doctrine_Query::create() ->from('Sticky') ->count(); if( $count >0 ) { } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; $this->response; $this->response->page = $page; $this->response->total = $total_pages; $this->response->records = $count; $query = Doctrine_Query::create() ->select('sticky_id,x,y,description, catalogue_id, page_id') ->from('Sticky') ->where('page_id=?', $page_id) ->andWhere('catalogue_id=?', $catalogue_id) ->execute(null, Doctrine::HYDRATE_ARRAY); foreach($query as $i => $row){ $this->response->rows[$i]['sticky_id']=$row['sticky_id']; } exit; }
$(document).ready(function(){ var page_id = $('#page_id').val(); var catalogue_id = $('#catalogue_id').val(); jQuery("#list_sticky").jqGrid({ url:'/data/StickyJson?page_id='+page_id+'&catalogue_id='+catalogue_id, editurl: '/data/StickyJson?page_id='+page_id+'&catalogue_id='+catalogue_id, datatype: "json", colNames:['ID','X', 'Y', 'DESCRIPTION'], colModel:[ {name:'sticky_id',index:'sticky_id'}, {name:'x',index:'x', editable:true}, {name:'y',index:'y', editable:true}, {name:'description',index:'description',align:"right",editable:true} ], pgbuttons:false, pgtext: null, height:'auto', rowNum:10, pager: '#pager_sticky', sortname: 'sticky_id', viewrecords: true, sortorder: "desc", caption:"Sticky", onSelectRow: function(id){ if(id){ jQuery('#list_sticky').jqGrid('editRow',id,true); } } }); jQuery("#list_sticky").jqGrid('navGrid',"#pager_sticky",{edit:false,add:true,del:true}); });
Problem jest taki ze np kiedy chce zedytowac rekord , skrypt gubi po drodze ponizsze zmienne:
$page = $_GET['page']; // get the requested page $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction
Co moze byc nie tak?