Skip to content

Trying to add a new plugin for only one filter but it is applied for all the filters seems. #241

@shrabanee

Description

@shrabanee

Hi

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions