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
formedit on double click
27/12/2009
03:43
Avatar
a6andrea
Member
Members
Forum Posts: 9
Member Since:
27/12/2009
sp_UserOfflineSmall Offline

Hello to everyone !!

First of all, sorry for my english, I don't speak and write it well.

this is my code:

.....

<script type="text/javascript">
jQuery(document).ready(function(){
  jQuery("#list").jqGrid({
    url:'example.php',
    datatype: 'xml',
    mtype: 'GET',
    colNames:['id','titolo'],
    colModel :[
      {name:'id', index:'id', width:200},
      {name:'titolo', index:'titolo', width:600, editable: true}
    ],
    editurl: "edit.php",
    pager: '#pager',
    rowNum:10,
    rowList:[10,20,30],
    sortname: 'id',
    sortorder: 'desc',
    viewrecords: true,
    caption: 'La mia tabella'
  });
 
    $("#bedata").click(function(){
    var gr = jQuery("#list").jqGrid('getGridParam','selrow');
    if( gr != null ) jQuery("#list").jqGrid('editGridRow',gr,{height:280,reloadAfterSubmit:false});
    else alert("Seleziona una riga da modifcare !");
    });   
});
</script>
 
</head>
<body>
<table id="list"></table>
<div id="pager"></div>
<input type="button" id="bedata" value="edit selected" />
</body>
</html>

1st question)

I would like to open the formedit dialog with a  "double clik" on the row that I choose, (I don't want press the button "edit selected"). How can I do it?

2nd question)

what kind of data is post the file "edit.php" and how can I use it for save the data in a mysql table?

Thank You for Everything !

Andrea

27/12/2009
06:56
Avatar
a6andrea
Member
Members
Forum Posts: 9
Member Since:
27/12/2009
sp_UserOfflineSmall Offline

edit,

I try to edit the code like this:

<script type="text/javascript">

var lastsel

jQuery(document).ready(function(){
  jQuery("#list").jqGrid({
    url:'example.php',
    datatype: 'xml',
    mtype: 'GET',
    colNames:['id','titolo'],
    colModel :[
      {name:'id', index:'id', width:200},
      {name:'titolo', index:'titolo', width:600, editable: true}
    ],
   
    ondblClickRow: function(id){
        if(id && id!==lastsel){
            jQuery('#list').jqGrid('restoreRow',lastsel);
            jQuery('#list').jqGrid('editGridRow',id);
            lastsel=id;
            }
        },
       
    editurl: "edit.php",
    pager: '#pager',
    rowNum:10,
    rowList:[10,20,30],
    sortname: 'id',
    sortorder: 'desc',
    viewrecords: true,
    caption: 'La mia tabella'
  });
});
</script>

now, on a doubleclick on o row, I can edit data using formedit dialog.

this is my file edit.php

<?php

//I connect to my database and it's all rigth

// How can I recovery the data passed from the formedit dialog ??

// $id = $_POST['id'];  // like this ??

// $titolo = $_POST['titolo'];  // like this ??

$sql=" UPDATE my_tab SET titolo='$titolo' WHERE id='$id' "

$res=mysql_query($sql,$db) or die(mysql_error());

?>

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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