ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: Hidehiro Ishii on December 22, 2017, 01:02:37 pm

Title: How to contorl to display or not a textbox and selectbox on toolbar
Post by: Hidehiro Ishii on December 22, 2017, 01:02:37 pm
Hi team,

I want to change between local filter and local head filter with [Toggle filter row] button.
So I want to control to display or not a button which are textbox(Filter:) and selectbox(filterColumn,filterCondition) on toolbar.
If I can do,please let me show sample code.

Regards,
Koichi
Title: Re: How to contorl to display or not a textbox and selectbox on toolbar
Post by: paramvir on December 22, 2017, 06:12:05 pm
It would be more clear if you share a screenshot.

This example https://paramquery.com/pro/demos/filter_header_local

has toggle filter row button and it let you change the Shipping Region condition via a custom UI ( checkbox in the example ).
Title: Re: How to contorl to display or not a textbox and selectbox on toolbar
Post by: Hidehiro Ishii on December 24, 2017, 02:56:12 pm
Hi Team,

I will show a screenshot image what i want.
Please check attached file.
If you have any question,please let me know.

Regards,
Koichi
Title: Re: How to contorl to display or not a textbox and selectbox on toolbar
Post by: paramvir on December 25, 2017, 01:32:10 pm
Please check this. It's created with help of jquery toggle API.

https://plnkr.co/edit/70lj3ewAHoawVTV7ySbQ?p=preview
Title: Re: How to contorl to display or not a textbox and selectbox on toolbar
Post by: Hidehiro Ishii on December 26, 2017, 06:41:17 am
Hi Team,

Thank you for your reply.
According to your sample code, I can control to display or not display these contents.
But I have a new question.
I want to clear a content of textbox with local filter mode when a mode of filter will change local header filter to local filter.
Because a content of textox with local filter remain after a filter mode changed.
I will show my sample code as follows.
Please let me know how to solve this problem.

Regards,
Koichi

[Sample code]

{
    type:'button',
    label: 'Toggle filter row',
    listener: function() {
        if (this.option('filterModel.header')) {
            this.reset({filter: true});
            this.option('filterModel.header', false);
            this.option('filterModel.mode', 'OR');
            this.refresh();
        }
        else {
            this.reset({filter: true});
            this.option('filterModel.header', true);
            this.option('filterModel.mode', 'AND');
            this.refresh();
        }
        this.toolbar().find(".toggle").toggle();
    }
},
               
{
    type: 'textbox',   <-- I want to clear a content of this textbox when a filter mode will change from local header filter mode to local filter mode.
    label: 'Filter: ',
    attr: 'placeholder="Enter your keyword"',
     cls: "filterValue toggle",
     listener: { keyup: filterhandler }
},
Title: Re: How to contorl to display or not a textbox and selectbox on toolbar
Post by: paramvir on December 26, 2017, 09:11:28 am
Textbox value can be cleared with val()

Code: [Select]
  this.toolbar().find(".filterValue").val("")

Hope it helps.
Title: Re: How to contorl to display or not a textbox and selectbox on toolbar
Post by: Hidehiro Ishii on December 26, 2017, 09:44:06 am
Hi Team,

Thank you for your very quick response!
Your answer is so good !
So my question is clear.
Please close this case.

Regards,
Koichi