Sigma Php Ajax framework, Ajax Components, GUI Builder
May 21, 2012, 08:24:05 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
Sigma Php Ajax framework, Ajax Components, GUI Builder
>
Sigma Grid
>
Sigma Grid - Q&A
(Moderators:
steven
,
gbolanoscruz
) >
paging error with php example
Pages: [
1
]
« previous
next »
Print
Author
Topic: paging error with php example (Read 166 times)
ilanb
Newbie
Posts: 2
paging error with php example
«
on:
November 17, 2011, 06:48:48 AM »
Hello,
I try to use pagination on grid, but when I clic on next, data is not loaded, here is my code:
index.php:
<script type="text/javascript"> var dsOption = { fields :[ {name : 'id' }, {name : 'f_name' }, {name : 'f_surname' }, {name : 'f_birthdate' }, {name : 'f_address' }, {name : 'f_phone' }, {name : 'f_mail' }, {name : 'f_type' }, {name : 'f_minor' }, {name : 'f_sending' } ], recordType : 'object' } var colsOption = [ {id: 'id' , header: "ID" , width:60}, {id: 'f_name' , header: "Prénom" , width:80}, {id: 'f_surname' , header: "Nom" , width:80}, {id: 'f_birthdate' , header: "Date de naissance" , width:120}, {id: 'f_address' , header: "Adresse" , width :100}, {id: 'f_phone' , header: "N° de Téléphone" , width :100}, {id: 'f_mail' , header: "Email" , width:80}, {id: 'f_type' , header: "Sex" , width:80}, {id: 'f_minor' , header: "Mineur" , width:100}, {id: 'f_sending' , header: "Réception" , width:100} ]; var gridConfig = { id : "scnf_grid", skin : 'mac', loadURL : 'Controller.php', exportURL : 'export_php/sncfList.php?export=true', exportFileName : 'sncf_data_form', container : 'sncf_grid', replaceContainer : true, dataset : dsOption, columns : colsOption, toolbarPosition : 'bottom', toolbarContent : 'reload | xls | filter | print | nav', pageSize : 20, pageSizeList : [05,10,15,20,25,50], encoding : 'UTF-8', showGridMenu : false, allowCustomSkin : true, filterable : true }; var mygrid=new Sigma.Grid( gridConfig ); //Sigma.Util.onLoad( Sigma.Grid.render(mygrid) ); Sigma.Util.onLoad(function(){mygrid.render()}); </script>
controller.php :
<?php include 'export_php/ConnectionManager.php'; header('Content-type:text/javascript;charset=UTF-8'); $json=json_decode(stripslashes($_POST["_gt_json"])); $conManager = new ConManager(); $conManager->getConnection(); if($json->{'action'} == 'load') { $sql = "SELECT * FROM t_form_sncf"; $handle = mysql_query($sql); $retArray = array(); while ($row = mysql_fetch_object($handle)) { $retArray[] = $row; } $data = json_encode($retArray); $ret = "{data:" . $data .",\n"; $ret .= "recordType : 'object'}"; echo $ret; } else if($json->{'action'} == 'save') { $sql = ""; $params = array(); $errors = ""; $deletedRecords = $json->{'deletedRecords'}; foreach ($deletedRecords as $value) { $params[] = $value->id; } $sql = "DELETE FROM t_form_sncf WHERE id IN (" . join(",", $params) . ")"; if(mysql_query($sql)==FALSE) { $errors .= mysql_error(); } $sql = ""; $updatedRecords = $json->{'updatedRecords'}; foreach ($updatedRecords as $value) { $sql = "UPDATE `t_form_sncf` SET ". "`f_name`='".$value->f_name . "', ". "`f_surname`='".$value->f_surname . "', ". "`f_birthdate`='".$value->f_birthdate . "', ". "`f_address`=".$value->f_address . ", ". "`f_phone`=".$value->f_phone . ", ". "`f_mail`=".$value->f_mail . ", ". "`f_type`=".$value->f_type . ", ". "`f_minor`='".$value->f_minor . "' ". "`f_sending`='".$value->f_sending . "' ". "WHERE `id`=".$value->id; if(mysql_query($sql)==FALSE) { $errors .= mysql_error(); } } $sql = ""; $insertedRecords = $json->{'insertedRecords'}; foreach ($insertedRecords as $value) { $sql = "INSERT INTO t_form_sncf (`f_name`, `f_surname`, `f_birthdate`, `f_address`,`f_phone`, `f_mail`, `f_type`, `f_minor`, `f_sending`) VALUES ('". $value->f_name."', '".$value->f_surname."', '".$value->f_birthdate."', '".$value->f_address."', '".$value->f_phone."', '".$value->f_mail."', '".$value->f_type."', '".$value->f_minor."', '".$value->f_sending."')"; if(mysql_query($sql)==FALSE) { $errors .= mysql_error(); } } $ret = "{success : true,exception:''}"; echo $ret; } ?>
Any idea ?
data is correctly loaded and exported in excel just nav don't work
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News & Announcements
-----------------------------
Sigma Visual GUI Builder & Library
-----------------------------
=> Sigma Visual - Knowledge Share
=> Sigma Visual - Q&A
=> Bug Report & Wishlist
-----------------------------
Sigma Grid
-----------------------------
=> Sigma Grid - Q&A
=> Show Case
=> Bug Report & Wishlist
-----------------------------
Other
-----------------------------
=> AJAX & JavaScript
Loading...