⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

add double click event with jquery



Edward
  • profile picture
  • Member

Posted 04 March 2012 - 13:09 PM

Hello from Spain,
This is my question, as I can list you could add to the event with jquery to double click to edit the contents of the table, for example, instead of pressing the edit button, can double click on the rowand has the same effect when I press the edit button.
Thanks and forgive my mistakes in English

Helton Eduardo Ritter
  • profile picture
  • Member

Posted 28 February 2013 - 16:55 PM

Hey, I've tryed to do it today too.

 

So, my solution is something like:

 

* It work ok with the theme "flexigrid"

 

1) In the file /assets/grocery_crud/themes/flexigrid/views/list.php

About line 28, abvore the following foreach ...

 

 

 

<?php foreach($list as $num_row => $row){ ?>
 

you should change the next line to:

 

 <tr <?php if(!$unset_edit){?> ondblclick="editMe('<?php echo $row->edit_url ?>')" <?php }  if($num_row % 2 == 1){?>class="erow"<?php }?>>
 

 

2) in the file /assets/grocery_crud/themes/flexigrid/views/list_template.php

 

At the end of file, add this

 

<?php if (!$unset_edit) { ?>
    <script>
        function editMe(url){
            window.location.href = url;
        }
    </script>
<?php } ?>
 

 

Maybe is not the best solution, but in my case, I wanna this behavior in all pages that I use GroceryCrud.

 

Works fine!

 


Edward
  • profile picture
  • Member

Posted 05 June 2013 - 20:09 PM

Thanks very much Helton, work fine!.
It worked fine with Chrome, IE9 and Firefox.
 
Thanks for reply.