super-elements / super-grid

0 stars 0 forks source link

Event Handlers for cells , rows, columns, headers, grid #8

Open gaurav21r opened 7 years ago

gaurav21r commented 7 years ago

Interaction with parts

We need Event Handlers for when users interact with specific parts of the grid.

Specific Parts of Grid

When the user clicks on a cell. We need something like a cell-click event to fire. Along with row-click and grid-click because of

  1. Event Bubbling
  2. It makes logical sense that when someone clicks a cell, they are also clicking on the row where the cell is

    Different Interactions

Like the example above, we need events to fire for click, hover, touch etc.

The event Object

e the custom event object should contain all the default event object properties. Eg in case of click which mouse button was used etc.

Also, when a click -like event fires, its very important to get a reference to the original data object of the grid. This can be in the form of a path or indices. Because we should be able to use nested objects #6 this complicated things a bit more. Eg: If I want to change the value of the cell when it was clicked, I need the path of where to change the object is <super-grid>'s data property.

Possible implementation

Please look at the documentation on custom events in Polymer which was created by yours truly :sunglasses:

Other Interactions

These are interactions that will be fired when plugins (like #3) do their custom thing. Eg: If there is a selection plugin implemented, it should fire the grid-selected event along with the Index of the row selected in e the event object.

Similar for sub-rows, editors, custom renderers etc.