I want to use a select as a filter and not the standard pqGrid selector. The following works, but seems messy:
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?