provide a handler for double click
Closed this issue · 8 comments
There should be a way to declare that a double click action has occured so a controller can take some interaction based on it.
This should be done by calling $emit with a TableEvents notificaiton
How is this generic double click handler differ from the HTML Mouse event?
you mean ondblclick? I suppose we can use ng-dblClick. The one problem though is, by default it would not send the model + ID of the items? So it would be up to the author to pull this information themselves vs. have an even that publishes the table ID, the row ID and the row model.
The user already has the ability to add ng-dblClick to the row template, what are we solving by wrapping this and pushing this information up higher?
so if you add ng-dblClick how easy is it for you to get the row, model representing the row etc? This is often the information you would need. Think about edit on double click.
if you have ng-dblClick="callFunction()" there will not be any arguments passed. So the user is left to set all this up in their row. Would it not be cleaner to have this emitted with all the parameters one would logically need?
If you needed the model in the function then it would be passed. For editing you additionally need the event so you know what element is being edited if you are swapping out components,
<tr ng-repeat="row in rowsObj" ng-dbl-click(row, $event)>
I may have missed your point about the row model, if you were referring to the location of the attribute being changes, such as the name field row.name
.
If that is the case then all I see an event being able to do it activate an editable-cell
directive. Without any additional parameters the directive would be able to know the model being modified in a simple edit case by running the uncompiled cell HTML through $interpolate
For now we'll go with ng-dbl-click and see how it works out. This may be reopened in the future if it proves insufficient.