jadrake75 / ng-scrolling-table

MIT License
8 stars 2 forks source link

provide a handler for double click #76

Closed jadrake75 closed 9 years ago

jadrake75 commented 10 years ago

There should be a way to declare that a double click action has occured so a controller can take some interaction based on it.

jadrake75 commented 10 years ago

This should be done by calling $emit with a TableEvents notificaiton

Xanir commented 9 years ago

How is this generic double click handler differ from the HTML Mouse event?

jadrake75 commented 9 years ago

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.

Xanir commented 9 years ago

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?

jadrake75 commented 9 years ago

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?

Xanir commented 9 years ago

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)>

Xanir commented 9 years ago

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

jadrake75 commented 9 years ago

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.