ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: RedBully on November 03, 2014, 05:58:07 pm

Title: Using callback for column filter
Post by: RedBully on November 03, 2014, 05:58:07 pm
I'm trying to use the callback for filter type as per
http://paramquery.com/pro/api#option-column-filter (http://paramquery.com/pro/api#option-column-filter)

Quote
type can be textbox, textarea, select, checkbox, callback function, html string or null. subtype can be triple for tri - state checkbox.

In my column model, I use
Code: [Select]
filter:
{
type: function (ui) { oa.renderFilter(this, ui); }
},

where my called method is

Code: [Select]
oa.renderFilter = function (grid, ui) {
        return "<div>Test</div>";
}

The table cell where the filter should be rendered is empty:

Code: [Select]
<td class="pq-grid-col"><div class="pq-grid-header-table-div" style="padding:0px 2px;"></div></td>

Am I correct to be returning html which should then be rendered or am I using the callback incorrectly?

I couldn't find a suitable example to copy in
http://paramquery.com/pro/demos/filter_header_local (http://paramquery.com/pro/demos/filter_header_local)
Title: Re: Using callback for column filter
Post by: paramvir on November 03, 2014, 07:40:11 pm
You are correct in returning HTML string, but first return is missing from your code.

Code: [Select]
type: function (ui) { return oa.renderFilter(this, ui); }
Title: Re: Using callback for column filter
Post by: RedBully on November 03, 2014, 08:41:15 pm
Of course!  Thanks very much!