ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: ralph1996 on October 25, 2016, 09:37:09 pm

Title: Grid Reference in Column Renderer
Post by: ralph1996 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

Title: Re: Grid Reference in Column Renderer
Post by: paramvir 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
Title: Re: Grid Reference in Column Renderer
Post by: ralph1996 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....