Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8283359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:42:27+00:00 2026-06-08T10:42:27+00:00

I have 2 checkboxes , Its called A and B . When i click

  • 0

I have 2 checkboxes, Its called A and B. When i click on the checkbox A, then all the a particular field in the Grid should filter all the values with the value A in it.

If i click B, then the filed in the grid should filter and display all the values that has B in it.

If i click both, then both A and B should be displayed.

        if (chkbxVal== 'A') {
        console.log('Only A');
        return rec.get('gridField') == 'A'; 
        } else if (chkbxVal == 'B'){
        console.log('Only B');
        return rec.get('gridField') == 'B'; 
        } else {
        console.log('both A and B');
        return rec;
        }

The above, works if i have 2 checkboxes. But what if i have 3 checkboxes (or more). Should i have 9 if-else conditions for it to work ? Look at the following prototype, it is only for 3 checkboxes, and i have like 6 or 7 then i should have 36 – 49 if-else conditions ? I am having a logic issue can someone help me ?

if (A){
// display A
} else if (B) {
// display B
} else if (C) {
//display C
} else if (A and B) {
//display A and B
} else if (A and C) {
// display A and C
} else if (B and C) {
//display B and C
} else {
// display all
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:42:30+00:00Added an answer on June 8, 2026 at 10:42 am

    No, that would not be a good idea. Here’s an example, it only goes up to ‘E’ but the example scales:

    Ext.require('*');
    
    Ext.define('MyModel', {
        extend: 'Ext.data.Model',
        fields: ['name', 'filterField']
    })
    
    Ext.onReady(function(){
    
        var active = [];
    
        function onBoxChange() {
            active = [];
            form.items.each(function(item){
                if (item.checked) {
                    active.push(item.inputValue);
                }        
            });
            updateGrid();
        }
    
        function updateGrid() {
            store.suspendEvents();
            store.clearFilter();
            store.filterBy(function(rec){
                return Ext.Array.indexOf(active, rec.get('filterField')) > -1;
            });
            store.resumeEvents();
            grid.getView().refresh();
        }
    
        var items = [];
    
        Ext.Array.forEach(['A', 'B', 'C', 'D', 'E'], function(name){
            items.push({
                boxLabel: name,
                xtype: 'checkbox',
                inputValue: name,
                checked: true,
                listeners: {
                    change: onBoxChange
                }
            });
        });
    
        var form = new Ext.form.Panel({
            flex: 1,
            items: items
        });
    
        var store = new Ext.data.Store({
            model: MyModel,
            data: [{
                name: 'A1',
                filterField: 'A'
            }, {
                name: 'A2',
                filterField: 'A'
            }, {
                name: 'A3',
                filterField: 'A'
            }, {
                name: 'B1',
                filterField: 'B'
            }, {
                name: 'B2',
                filterField: 'B'
            }, {
                name: 'C1',
                filterField: 'C'
            }, {
                name: 'C2',
                filterField: 'C'
            }, {
                name: 'C3',
                filterField: 'C'
            }, {
                name: 'D1',
                filterField: 'D'
            }, {
                name: 'E1',
                filterField: 'E'
            }, {
                name: 'E2',
                filterField: 'E'
            }, {
                name: 'E3',
                filterField: 'E'
            }, {
                name: 'E4',
                filterField: 'E'
            }]
        });
    
        var grid = new Ext.grid.Panel({
            flex: 1,
            store: store,
            columns: [{
                dataIndex: 'name',
                text: 'Name'
            }]
        });
    
        new Ext.container.Viewport({
            layout: {
                type: 'vbox',
                align: 'stretch'
            },
            items: [form, grid]
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, i have checkboxes: <input type='checkbox' name='fruit' value='apple'> Apple <input type='checkbox' name='fruit' value='orange'>
I have an Event model with a finish_time field and a form checkbox called
I have a custom Checkbox its made in a Div <div class=zs name=toggle state=on
I have created checkboxes. When I selected multiple checkboxes then how can I get
As a workaround for the fact that asp:Checkboxes don't have values, I am attempting
I have six checkboxes. Shown as like this Checkbox1 <input type=checkbox id=check1> Checkbox2 <input
If I have a CheckBox control called chkTest , what would be an accurate
I have a viewmodel called ArticleAdmin that includes a list of checkboxes: public class
i have a group of audiences with checkboxes hidden under its audience group. now,
I have a recursive function being called before a .click handler (this checks to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.