Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to correctly associate double click with the Edit?
Message
Information générale
Forum:
Javascript
Catégorie:
JQuery
Divers
Thread ID:
01570547
Message ID:
01571404
Vues:
34
>>So the difference with the original flexigrid code and new one is that in the original the trSelected seemed to attach when I selected a row with the mouse. Right now this class only attaches after I click on the row. That's the difference and that's why that code didn't work.
>>
>
>If you're not actually letting them edit all the selected items (that is, you're just editing the item they double-clicked on), why not just grab the object reference that is passed when the dblclick() event is called, ex:
>
>
>$('#flexClients').dblclick(function (e) {
>   var id = $(e.target).attr('id')';
>   // id should contain the row id
>});
>
I got it to work with this code
$('#flexClients').dblclick(function (e) {
   var $row = $(e.target).closest('tr');
   var id = $row.attr('id');
   
   var ClientName;
   ClientName = $('td:eq(2)', $row).text();

   editRow(id, ClientName);
});

function editRow(id, ClientName)
{
   id = id.substring(id.lastIndexOf('row') + 3);
   currentId = id;
   $('#fntype').val('Edit');
   var url = '/Client/Edit/' + id;

   $.get(url, function (html) {
      $($dlg).html(html);
   });

   RunModalDialog("Edit Client: " + ClientName);
}
Thanks again, the double click now fires without extra click.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform