Trying to add a new plugin for only one filter but it is applied for all the filters seems.
See original GitHub issueHi
I want to show a custom calendar for filter of type ‘date’, on clicking on the input field provided (same way as it is being done in the widget demo by using bootstrap-datepicker). For that I have created a new plugin in my code. The code is as given below
// Adding new plugin 'showCalender'
$.fn.queryBuilder.define('showCalender', function(opt)
{
this.on("click", this.showCal);
});
/**
* Adding new function to show calender on click
*/
$.fn.queryBuilder.extend({
showCal : function(element)
{
if($(element.target).attr("class") === "form-control" && $(element.target).attr("type") === "text" )
{
//Do stuff here to show the calender
}
}
}); builder.queryBuilder({
sortable: true,
plugins:
{
'showCalender': true //
},
filters:
[
{
id: 'ona',
label: 'Org Name',
type: 'string'
},
{
id : 'ca',
label : 'Created at',
type : 'date' //I want to initialize for this filter
}
]
});
When I am clicking on input field for id: ‘ona’ filter, then also it is showing the calender. I have tried “plugin : showCalender” but it did not work and throws some error. I guess the error is because plugin is not jQuery plugin. So Is there any way to initialize the plugin ‘showCalender’ for only 2nd filter?
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Filters not working | WordPress.org
The filter in the Media Library doesn't seem to work. On grid view, selecting a term seems to refresh the view, but it's...
Read more >JetSmartFilters Not Working: 7 Things You Need to Check
In this troubleshooting article, you will find solutions to the 7 most common issues why JetSmartFilters may not be working.
Read more >Include filtering attributes with plug-in registration - Power Apps
Filtering attributes are a list of entity attributes that, when changed, cause the plug-in to execute. These attributes can be set when ......
Read more >Product Filters - WooCommerce
Installation · Purchase the product from WooCommerce.com · Download the ZIP file from your WooCommerce.com dashboard · Go to Plugins > Add New...
Read more >Use filters in Adobe Photoshop
To apply filters cumulatively, click the New Effect Layer icon , and choose an additional filter to apply. Repeat this procedure to add...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
(edited your message with valid markdown for code blocks)
So you found the problem: you need a jQuery plugin, not a QueryBuilder plugin.
It’s as simple as :
Do not forget to do
this.trigger('change')
after changing the input value, otherwise the builder will not refresh it’s model.Okay. Thanks again @mistic100