Merge pull request #10645 from Koloto/slickgrid

slickgrid: fixed getCellFromEvent signature, using DOMEvent in subscribe
This commit is contained in:
Paul van Brenk
2016-08-18 11:40:31 -07:00
committed by GitHub
2 changed files with 11 additions and 6 deletions

View File

@@ -155,8 +155,6 @@ grid.getCellCssStyles("test")[0]["number_column"];
grid.getCellEditor();
grid.getCellFromEvent(new Slick.Event());
grid.getCellFromPoint(5, 10);
grid.getCellNode(5, 10);
@@ -210,3 +208,8 @@ columns.forEach(column => {
grid.onSort.subscribe((e, args) => {
var sortCol:string = args.sortCols[0].sortCol.field;
});
grid.onMouseEnter.subscribe((e: DOMEvent, args: Slick.OnMouseEnterEventArgs<MyData>) => {
let cell: Slick.Cell = args.grid.getCellFromEvent(e);
if (!cell) { return; }
});

View File

@@ -92,14 +92,16 @@ declare namespace Slick {
* @method subscribe
* @param fn {Function} Event handler.
*/
public subscribe(fn: (eventData: EventData, data: T) => any ): void;
public subscribe(fn: (e: EventData, data: T) => any): void;
public subscribe(fn: (e: DOMEvent, data: T) => any): void;
/***
* Removes an event handler added with <code>subscribe(fn)</code>.
* @method unsubscribe
* @param fn {Function} Event handler to be removed.
*/
public unsubscribe(fn: (eventData: EventData, data: T) => any ): void;
public unsubscribe(fn: (e: EventData, data: T) => any): void;
public unsubscribe(fn: (e: DOMEvent, data: T) => any): void;
/***
* Fires an event notifying all subscribers.
@@ -1037,7 +1039,7 @@ declare namespace Slick {
* @param e A standard W3C/jQuery event.
* @return
**/
public getCellFromEvent<T>(e: Event<T>): Cell; // todo: !! Unsure on return type !!
public getCellFromEvent(e: DOMEvent): Cell;
/**
* Returns a hash containing row and cell indexes. Coordinates are relative to the top left corner of the grid beginning with the first row (not including the column headers).
@@ -1045,7 +1047,7 @@ declare namespace Slick {
* @param y A y coordinate.
* @return
**/
public getCellFromPoint(x: number, y: number): Cell; // todo: !! Unsure on return type !!
public getCellFromPoint(x: number, y: number): Cell;
/**
* Returns a DOM element containing a cell at a given row and cell.