Forum



23:22

10/01/2012

to start a local datatype (i use a local array) because i don't
touch the database, I just want to be able to insert,
edit and delete rows on the client side. And then when this
ended, newly obtained data and upload it to the database. But by adding
does nothing, call to "someurl.php", but i don't know what to do with those
data to update the data grid.
This is the code
var mydata= []; // Empty array because i want to show details of an invoice empty
jQuery("#table").jqGrid({
data: mydata,
datatype: 'local',
colNames:['Nº','Quantity', 'Description', 'Cost','SubTotal'],
{name:'quantity', width:100,editable:true,sortable:false},
{name:'description', width:400, edittype:"textarea",align:"right",editable:true,
{name:'cost', width:150, align:"right",editable:true,sortable:false,editrules:
{name:'subtotal', width:150,editable:true, sortable:false}
],
height: 'auto',
pager: '#pager',
});
jQuery("#table").jqGrid('navGrid',"#pager",{add:true,edit:true,del:true, search:false, refresh:false},
{height:370,width:400,reloadAfterSubmit:true,url:'someurl.php'}, // edit options
{height:370,width:400,reloadAfterSubmit:true,url:'someurl.php'}, // add options
{reloadAfterSubmit:false,url:'fede.php'} // del options
);
</script>
if($_POST[oper]=='add') {
$number = $_POST['number'];
$quantity = $_POST['quantity'];
$description = $_POST['description'];
$cost= $_POST['cost'];
$subtotal = $_POST['subtotal'];
$model = array(
array("number"=>"$number","quantity"=>"$quantity",
"description"=>"$description",
"cost"=>"$cost", "subtotal"=>$cost* $cantidad));
// MODIFIES USER RECORD
} elseif($_POST[oper]=='edit') {
$number = $_POST['number'];
$quantity = $_POST['quantity'];
$description = $_POST['description'];
$cost = $_POST['cost'];
$subtotal = $_POST['subtotal'];
} elseif($_POST[oper]=='del') {
$number = $_POST['number'];
$quantity = $_POST['quantity'];
$description = $_POST['description'];
$cost = $_POST['cost'];
$subtotal = $_POST['subtotal'];
}
return $model;
?>
Most Users Ever Online: 715
Currently Online:
60 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66