[CLOSED] Add dynamic checkbox in javascript

  1. #1

    [CLOSED] Add dynamic checkbox in javascript

    Hi guys,

    i wan't add dynamic checkbox in checkboxgroup in js

    i test http://forums.ext.net/showthread.php...during-runtime
    but this post don't laufen in ext.net 2.1.

    control.js

    var showAdvancedRight = function (item, record, node, index, e)
    {
        try {
    
            var listeElement = record.data.ListeUiElement.split(',');
            Ext.getCmp('groupTab_LabelTitleAdvanced').setText(record.data.text + ' :');
            for (i = 0; i < listeElement.length; i++) {
                var group = Ext.getCmp('groupTab_CheckBoxGroupAdvanced');
                var cfg = group.initialConfig;
                cfg.items.add({
                    id: 'groupTab_checkbox_' + record.data.text + i,
                    xtype: "checkbox",
                    boxLabel: listeElement[i]
                });
                group.destroy();
                new Ext.form.CheckboxGroup(cfg);
            }
        }
        catch (ex) {
            App.direct.UnhandledException(' Show advanced rights ' + ex);
        }
    }
    control.ascx

    <ext:Panel ID="PanelAdvancedRight" runat="server" Region="East" MinWidth="300" Split="true">
                                                        <Items>
                                                            <ext:FieldSet ID="GroupAdvancedRights" runat="server" Title="<%$ Resources:UserGroupRightsTab, AdvancedRights %>"
                                                                Layout="VBoxLayout" AnchorHorizontal="100%" AnchorVertical="100%" Margin="10">
                                                                <Items>
                                                                    <ext:Label ID="LabelTitleAdvanced" runat="server" />
                                                                    <ext:CheckboxGroup ID="CheckBoxGroupAdvanced" runat="server" />
                                                                </Items>
                                                            </ext:FieldSet>
                                                        </Items>
                                                    </ext:Panel>
    Regards

    Yoann
    Last edited by Daniil; Jan 08, 2013 at 3:22 PM. Reason: [CLOSED]
  2. #2
    Hi @Tactem,

    The add method appears to function well.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            var add = function () {
                App.CheckboxGroup1.add({
                    boxLabel: "dynamic"    
                });
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:CheckboxGroup ID="CheckboxGroup1" runat="server" ColumnsNumber="1">
                <Items>
                    <ext:Checkbox runat="server" BoxLabel="static" />
                </Items>
            </ext:CheckboxGroup>
            
            <ext:Button runat="server" Text="add" Handler="add" />
        </form>
    </body>
    </html>
  3. #3
    Thanks a lot Daniil for your speed response, as always.

    Yoann

Similar Threads

  1. Replies: 12
    Last Post: Sep 20, 2011, 2:33 PM
  2. Replies: 0
    Last Post: Jul 18, 2011, 8:05 PM
  3. Dynamic Checkbox TreePanel
    By Ganesh3.shirsath in forum 1.x Help
    Replies: 1
    Last Post: Jan 27, 2011, 1:16 PM
  4. Replies: 0
    Last Post: Sep 20, 2010, 11:19 AM
  5. [CLOSED] Dynamic checkbox group with database
    By CSG in forum 1.x Premium Help
    Replies: 1
    Last Post: Jun 10, 2009, 5:29 PM

Tags for this Thread

Posting Permissions