Author Topic: Grid Reference in Column Renderer  (Read 2261 times)

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Grid Reference in Column Renderer
« on: October 25, 2016, 09:37:09 pm »
How can I get a reference to the grid or the grid Element Id in the render callback for a column.  There is no event argument to use:

var $grid = $( event.target ).closest( '.pq-grid' );

Thank you


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Grid Reference in Column Renderer
« Reply #1 on: October 25, 2016, 10:11:33 pm »
Reference to grid instance is available in any callback or event listener from context i.e., "this" variable.

var grid = this; //grid instance.

var $grid = grid.widget(); //grid DOM element wrapped in jQuery object.

Reference:

http://paramquery.com/pro/tutorial#topic-special-vars

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Re: Grid Reference in Column Renderer
« Reply #2 on: October 25, 2016, 11:26:37 pm »
Yes, that is what I expecetd but was nto seeing that. However,  I was calling a named function from the actual event handler and the named function scope is not the grid.  However if the handler passes its scope (this) to the named function I get the grid.

Thank You....