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_TopicIcon
Delete how to?
20/09/2009
05:14
Avatar
vocoder21
Member
Members
Forum Posts: 5
Member Since:
20/09/2009
sp_UserOfflineSmall Offline

hi all!

I am new in jqgrid and i need some help 🙂

I have a datagrid to add,delete and edit customers.

I am using the mavigation buttons for these works.

My javascript code is the following :

<script type="text/javascript">
jQuery(document).ready(function () {
  jQuery("#listcust").jqGrid ( {
    url:'xml/customers_xml.php',
    datatype: "xml",
    mtype: 'GET',
    colNames:['ΚΔΩ.','ΟΝΟΜΑΤΕΠΩΝΥΜΟ','ΤΗΛΕΦΩΝΟ','E-MAIL','ΔΙΕΥΘΥΝΣΗ','ΣΗΜΕΙΩΣΕΙΣ'],
    colModel :[
      {name:'custid', index:'custid', width:90, editable:true,editoptions:{size:25}},
      {name:'custname', index:'custname', width:90, editable:true,editoptions:{size:25}},
      {name:'custphone', index:'custphone', width:90, editable:true,editoptions:{size:25}},
      {name:'custmail', index:'custmail', width:90, editable:true,editoptions:{size:25}},
      {name:'custaddress', index:'custaddress', width:90, editable:true,editoptions:{size:25}},
      {name:'custnotes', index:'custnotes', width:190, editable:true,editoptions:{size:25}}
    ],
    pager: jQuery('#pager1'),
    rowNum:20,
    rowList:[10,20,30],
    sortname: 'custid',
    sortorder: 'desc',
    viewrecords: true,
    autowidth: true,
    height: 440,
    loadtext: "ΦÏŒρτωμα Δεδομένων...",
    editurl:"xml/edit_customers_xml.php",
    addurl:"xml/add_customers_xml.php",
    caption: 'ΛΙΣΤΑ ΠΕΛΑΤΩΝ'
  })
  .navGrid('#pager1',{view:true, del:true, clearAfterAdd:true, search: true,add:true,closeAfterEdit:true},
{height:280,reloadAfterSubmit:true},
{height:280,reloadAfterSubmit:true},
{height:280,reloadAfterSubmit:false},  // delete instead that del:false we need this
{multipleSearch : true}, // enable the advanced searching
{closeOnEscape:true} /* allow the view dialog to be closed when user press ESC key*/
);

//  $("#bedata").click(function(){
//      var gr = jQuery("#listcust").getGridParam('selrow');
//      if( gr != null ) jQuery("#listcust").editGridRow(gr,{height:280,reloadAfterSubmit:false});
//      else alert("ΠαρακαλÏŽ επιλέξτε κάποια εγγραφή πρÏŽτα");
//    });
 
});

</script>

My edit page has the following code:

<?php
include ("../includes/db.php");

if ($_POST[custid]=="") {

//insert new row sql code

}
else {

//edit row sql code

}

  ?>

So if the custid is empty i call the add new row mysql code . id the custid has a valid id i call the edit mysql code. My question is how i inspect the delete ? what may i GET or POST for delete?

Sorry for my bad english

20/09/2009
12:27
Avatar
uruguay
Member
Members
Forum Posts: 20
Member Since:
20/09/2009
sp_UserOfflineSmall Offline

HI.

I do it this way:

if($_POST['oper]=="add"){

//insert

}else if($_POST['oper']=="edit"){

//update

}else if ($_POST['oper']=="del"){

//delete

}

21/09/2009
11:57
Avatar
vocoder21
Member
Members
Forum Posts: 5
Member Since:
20/09/2009
sp_UserOfflineSmall Offline

thank you very much 🙂

it works 🙂

14/06/2011
23:24
Avatar
playdog
New Member
Members
Forum Posts: 1
Member Since:
14/06/2011
sp_UserOfflineSmall Offline

if($_POST['oper]=="add"){

What is    'oper'     ????

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
165 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