indraramadhann / jquery-datatables-editable

Automatically exported from code.google.com/p/jquery-datatables-editable
0 stars 0 forks source link

Proper method for changing default edit event to single click? #99

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
jquery-datatables-editable uses double click for editing. This makes it 
unusable on the current Ipad's Safari browser.

I can change the aoColumns:[ {event:'click'} ] for each column, but this makes 
row-selection tricky/not-possible.

1. Is there an option to change the jeditable event for all columns at once?
2. Is there a way to have the clicked element's row automatically selected.

Thanks,
Ahmet.

Original issue reported on code.google.com by ahmetmsa...@gmail.com on 12 Mar 2012 at 8:04

GoogleCodeExporter commented 9 years ago
Hi,

Could you try to add the oEditableSettings paremeter in the dataTable:

oTable.dataTable().makeEditable({ oEditableSettings: { event: 'click' } });

If you use FireBug debuger you can trace in the latest version of plugin in the 
line 
http://code.google.com/p/jquery-datatables-editable/source/browse/trunk/media/js
/jquery.dataTables.editable.js#388 is it properly set.

However, this is tricky change. Click event is already used for selecting a row 
so I'm not sure how it should handle click in both cases.

Jovan

Original comment by joc...@gmail.com on 13 Mar 2012 at 4:04

GoogleCodeExporter commented 9 years ago
Hi Jovan,

Your suggestion works. Thank you.

jEditable prevents the click event from propagation. Changing line388 to the 
following works:

editablesettings=$.extend({}, oDefaultEditableSettings, 
properties.oEditableSettings);
cells.editable(properties.sUpdateURL, $.extend({}, editablesettings, 
{event:'clickme'}));
cells.each(function(){$(this).on(editablesettings.event,function(){$(this).trigg
er('clickme'); });});

If you add this to your code, remember to also change line380 to:
$(this).editable(sUpdateURL, $.extend({}, oColumnSettings, {event:'clickme'}));
$(this).on(oColumnSettings.event,function(){$(this).trigger('clickme'); });

Ahmet.

Original comment by ahmetmsa...@gmail.com on 14 Mar 2012 at 6:46

GoogleCodeExporter commented 9 years ago
Hi,

I'm not sure it this what you you have implemented but I have created example 
on 
http://jquery-datatables-editable.googlecode.com/svn/trunk/custom-edit-events.ht
ml It enables click and mouseover events for editing. It also enables row 
selection when cell is clicked. However, I have also added one blank column 
that is not editable which can be used for selection only.

Jovan 

Original comment by joc...@gmail.com on 15 Mar 2012 at 9:02

GoogleCodeExporter commented 9 years ago
Thanks for the example. Yes, your example fits the bill.
Ahmet.

Original comment by ahmetmsa...@gmail.com on 16 Mar 2012 at 12:20

GoogleCodeExporter commented 9 years ago

Original comment by joc...@gmail.com on 16 Mar 2012 at 11:49