Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
I add a new row, but nothing happened with the grid
11/01/2012
23:22
Avatar
chucky2183
Argentina
Member
Members
Forum Posts: 3
Member Since:
10/01/2012
sp_UserOfflineSmall Offline
Hello. I just created a grid of a detail of an invoice and shows it well. I charge
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

<script>
   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'],

       colModel:[{name:'number',width:100, sortable:false,editoptions:{readonly:true,size:10}},
                 {name:'quantity', width:100,editable:true,sortable:false},
                 {name:'description', width:400, edittype:"textarea",align:"right",editable:true,
                        sortable:false},
                 {name:'cost', width:150, align:"right",editable:true,sortable:false,editrules:
                       {number:true}},
                 {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>

someurl.php (Here i don't know how to do to edit the grid) adding, modifying or deleting
<?php
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;
?>
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
42 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information