Author Topic: How to contorl to display or not a textbox and selectbox on toolbar  (Read 3151 times)

Hidehiro Ishii

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 44
    • View Profile
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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: How to contorl to display or not a textbox and selectbox on toolbar
« Reply #1 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 ).

Hidehiro Ishii

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: How to contorl to display or not a textbox and selectbox on toolbar
« Reply #2 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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: How to contorl to display or not a textbox and selectbox on toolbar
« Reply #3 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

Hidehiro Ishii

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: How to contorl to display or not a textbox and selectbox on toolbar
« Reply #4 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 }
},

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: How to contorl to display or not a textbox and selectbox on toolbar
« Reply #5 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.

Hidehiro Ishii

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: How to contorl to display or not a textbox and selectbox on toolbar
« Reply #6 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