Results 1 to 2 of 2

Thread: "Checking" checkboxes from a query

  1. #1

    Default "Checking" checkboxes from a query

    Hey there! I'm new on Extjs, i'm with some problems.

    I'm creating this panel with values from my table. How can I have the checkboxes get "checked" returning values from from my query?

    Code:
    Ext.getStore('storeCmbCia').load({params:{'usuarioid':Ext._tabusuarios_id_usuario}});
    
    
    Ext.Ajax.request({
        url: 'cakephp/Usuariosconfig/ConfigCiaUsu',
        method : "POST",
        headers: {
            'Content-Type': 'application/json'
        },
        jsonData: true,
        useDefaultXhrHeader : false,
        withCredentials: true,
        success : function(response) {
    
    
            var jsonResponse = JSON.parse(response.responseText);
    
    
            if(jsonResponse.success == 1){
    
    
                var totalMenu = jsonResponse.data.lenght;
                var xyz= 0;
                var PanelMenu = Ext.getCmp("configMenu");
    
    
                Ext.Array.each(jsonResponse.data, function(record) {
    
    
                    if(record.subhijos === "si"){
                        accordPanel = Ext.create("Ext.form.FieldSet", {
                            title:record.menu,
                            margin: 5,
                            height: 450,
                            id: 'fs'+record.opctab
                        });
                        PanelMenu.add(accordPanel);
    
    
    
    
                        var menuItem;
                        Ext.Array.each(record.childrensub, function(recordsub) {
    
    
                            if(recordsub.subsubhijos === "si"){
                                if(xyz===0){
                                    menuItem = Ext.create("Ext.form.Label", {//Si Tiene un SubSubMenu
                                        text: recordsub.submenu+":",
                                    });
                                }else{
                                    menuItem = Ext.create("Ext.form.Label", {//Si Tiene Más de un SubSubMenu
                                        text: recordsub.submenu+":",
                                    });
                                }
                                accordPanel.add(menuItem);
    
    
                                //------------------Crea SubSubMenus
                                var subMenuItem;
                                Ext.Array.each(recordsub.childrensubsub, function(recordsubsub) {
                                    var textNodo = recordsubsub.sub_submenu;
                                    subMenuItem = Ext.create("Ext.form.field.Checkbox", {
                                        fieldLabel:recordsubsub.sub_submenu,
                                        labelWidth: 180,
                                        id: 'chk'+ recordsubsub.opctab,
                                        padding: '0 0 0 50'
                                    });
                                    accordPanel.add(subMenuItem);
                                });
                            }else{
    
    
                                //------------------Crea SubMenus Sin Hijos
                                menuItem = Ext.create("Ext.form.field.Checkbox", {
                                    fieldLabel:recordsub.submenu,
                                    labelWidth: 230,
                                    id: 'chk'+ recordsub.opctab,
                                });
                                accordPanel.add(menuItem);
                            }
    
    
    
    
                        });
                        xyz=1;
                    }else{
                        //------------------Crea Menus Sin Hijos
                        accordPanel = Ext.create("Ext.form.FieldSet", {
                            title:record.menu,
                            margin: 5,
                            height: 450,
                            id: 'fs'+record.opctab
                        });
                        PanelMenu.add(accordPanel);
                        var menu_s = Ext.create("Ext.form.field.Checkbox", {
                            fieldLabel: record.menu,
                            labelWidth: 230,
                            id: 'chk'+ record.opctab
                        });
                        accordPanel.add(menu_s);
                    }
                });
                Ext._firtsOpen = 0;
            }else{
                Ext.Msg.alert("Error",jsonResponse.message);
            }
        },
        failure : function(response) {
            var respObj = Ext.JSON.decode(response.responseText);
            Ext.Msg.alert("Error", respObj.status.statusMessage);
        }
    });

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Can you use the checked config? There's an example on the checkbox doc page.
    http://docs.sencha.com/extjs/6.2.0/c....Checkbox.html

Similar Threads

  1. Replies: 1
    Last Post: 9 Oct 2011, 5:53 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •