ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: jplevene on August 04, 2025, 08:24:14 pm

Title: Create a filter that is a <select>
Post by: jplevene on August 04, 2025, 08:24:14 pm
I want to use a select as a filter and not the standard pqGrid selector.  The following works, but seems messy:

Code: [Select]
rating_filter = {
crules:[{condition:"contain"}],
// type:"select", // HAS NO EFFECT
init: function(ui)
{
// Cretae a new <select>
var sel = $("<select>", {style:"width:100%; text-align:"+dir})
.insertAfter(ui.$editor)
.change(function(){ ui.$editor.val(this.value).change(); });
// Hide the input
ui.$editor.hide();
// Add the options
$("<option>", {html:"All", value:""}).appendTo(sel);
for(let i=0; i<6; i++)
$("<option>", {text:"★".repeat(i), value:i}).appendTo(sel);
ui.listener = "change";
// Hide the clear icon
ui.$cell.find("span.pq-clear-icon").hide();
// Send back message all good
return true;
}
};

Is there a better way?