ShinobiDataGrid: add a gestureRecognizer on headerCell


#1

Hi,

I would like to add a specific gesture recognizer on a header cell of a ShinobiDataGrid.

I tried different solutions (see below) but nothing seems to work. Any Idea ?

SDataGridColumn *col = [[SDataGridColumn alloc] initWithTitle:obj forProperty:headerId];
col.sortMode = SDataGridColumnSortModeTriState;

UISwipeGestureRecognizer *gestSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleOperationTypeSwiped:)];

 [gestSwipe setDirection:(UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft)];

 //[col.headerCell addGestureRecognizer:gestSwipe]; //does not work

  //[col.headerCell.inputView addGestureRecognizer:gestSwipe]; //does not work

  [col.headerCell.textField addGestureRecognizer:gestSwipe]; //does not work

#2

Hi,

Unfortunately this isn’t possible with the grid at the moment. You can’t add a gesture recognizer to the grid because it handles touch events internally. One possible workaround is to add the handler to the view that contains the grid, and manually calculate when you want the gesture to have an effect based on it’s position.

I’d approach this by placing a view on top of the grid and trying to get it to synchronise it’s position with the cell you want to add the gesture to. Then once that is done, you can add the gesture recognizer to that.

We realise this isn’t ideal, but we are looking to address it in a future release. Stay tuned!

Regards,
Chris


#3

Thanks for the reply !