lundi 24 août 2020

Javascript (extjs) : check only one checkbox from two

The application I am working on is based on ExtJS, and what I would like to do is to allow the use to check only one checkbox.

The thing is that my application is very complex, and I don't really know a lot on ExtJS. The checkbox is initialized in a class viewport.js like this :

Ext.define('Viewport', {
    extend : 'Ext.container.Viewport',
    require : ['A','B'],
    frame : true,
    layout : 'fit',
    items : [{
                xtype : 'container',
                layout : 'hbox',
                margins : "a b c d",
                items : [{
                    margins : "0 0 5 35",
                    name : 'box1',
                    inputValue : true,
                    xtype : 'checkbox',
                    id : 'box1-box-id',
                    boxLabel : "BOX 1"
                }
                ,{
                    margins : "0 0 5 35",
                    name : 'box2',
                    inputValue : true,
                    xtype : 'checkbox',
                    id : 'box2-box-id',
                    boxLabel : "BOX 2"
                }]
            }
})

I don't know how to modify this code to have the user checking only one of these checkboxes. Do I have to add a function in this class?




Aucun commentaire:

Enregistrer un commentaire