Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: jGrid
Forum PHP.pl > Forum > XML, AJAX
rad11
Mam problem podczas edytowania, dodawania i usuwania rekordu i nie moge za cholere dojsc dlaczego:

  1.  
  2. public function executeStickyJson(sfWebRequest $request){
  3.  
  4. $page = $_GET['page']; // get the requested page
  5. $limit = $_GET['rows']; // get how many rows we want to have into the grid
  6. $sidx = $_GET['sidx']; // get index row - i.e. user click to sort
  7. $sord = $_GET['sord']; // get the direction
  8. $page_id = $_GET['page_id'];
  9. $catalogue_id = $_GET['catalogue_id'];
  10. $count = Doctrine_Query::create()
  11. ->from('Sticky')
  12. ->count();
  13. if( $count >0 ) {
  14. $total_pages = ceil($count/$limit);
  15. } else {
  16. $total_pages = 0;
  17. }
  18.  
  19. if ($page > $total_pages) $page=$total_pages;
  20. $start = $limit*$page - $limit;
  21. $this->response;
  22. $this->response->page = $page;
  23. $this->response->total = $total_pages;
  24. $this->response->records = $count;
  25.  
  26. $query = Doctrine_Query::create()
  27. ->select('sticky_id,x,y,description, catalogue_id, page_id')
  28. ->from('Sticky')
  29. ->where('page_id=?', $page_id)
  30. ->andWhere('catalogue_id=?', $catalogue_id)
  31. ->execute(null, Doctrine::HYDRATE_ARRAY);
  32.  
  33. foreach($query as $i => $row){
  34. $this->response->rows[$i]['sticky_id']=$row['sticky_id'];
  35. $this->response->rows[$i]['cell']=array($row['sticky_id'],$row['x'],$row['y'],$row['description']);
  36. }
  37. echo json_encode($this->response);
  38. }


  1. $(document).ready(function(){
  2. var page_id = $('#page_id').val();
  3. var catalogue_id = $('#catalogue_id').val();
  4.  
  5. jQuery("#list_sticky").jqGrid({
  6. url:'/data/StickyJson?page_id='+page_id+'&catalogue_id='+catalogue_id,
  7. editurl: '/data/StickyJson?page_id='+page_id+'&catalogue_id='+catalogue_id,
  8. datatype: "json",
  9. colNames:['ID','X', 'Y', 'DESCRIPTION'],
  10. colModel:[
  11. {name:'sticky_id',index:'sticky_id'},
  12. {name:'x',index:'x', editable:true},
  13. {name:'y',index:'y', editable:true},
  14. {name:'description',index:'description',align:"right",editable:true}
  15. ],
  16. pgbuttons:false,
  17. pgtext: null,
  18. height:'auto',
  19. rowNum:10,
  20. pager: '#pager_sticky',
  21. sortname: 'sticky_id',
  22. viewrecords: true,
  23. sortorder: "desc",
  24. caption:"Sticky",
  25. onSelectRow: function(id){
  26. if(id){
  27. jQuery('#list_sticky').jqGrid('editRow',id,true);
  28. }
  29. }
  30. });
  31. jQuery("#list_sticky").jqGrid('navGrid',"#pager_sticky",{edit:false,add:true,del:true});
  32.  
  33. });


Problem jest taki ze np kiedy chce zedytowac rekord , skrypt gubi po drodze ponizsze zmienne:

  1. $page = $_GET['page']; // get the requested page
  2. $sidx = $_GET['sidx']; // get index row - i.e. user click to sort
  3. $sord = $_GET['sord']; // get the direction


Co moze byc nie tak?
Pyton_000
Bo nie dodajesz ich do URL wywołania skryptu.
Masz tylko page_id itd. ale tych nie masz.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.