[CLOSED] Checkboxlist in gridpanel component column

  1. #1

    [CLOSED] Checkboxlist in gridpanel component column

    Hi
    Mine is an Asp.net MVC razor view application

    I have an gridpanel which has component column in it.

    I wanna show checkboxlist quite similar to MultiCombo except the combobbox behaviour. i.e. an MultiSelect having checkboxes in it.

    I search for such control at http://mvc.ext.net/ but didn't got any example.

    Is there any such control? if yes - can i get an example of it. if not - what could be my approach for such requirement.

    thanks
    Last edited by Daniil; Apr 20, 2014 at 3:55 PM. Reason: [CLOSED]
  2. #2
    Hi @PriceRightHTML5team,

    Maybe a CheckboxGroup?
  3. #3
    Hi Daniil,
    Following is my markup for checkboxgroup in gridpanel component column

    Html.X().ComponentColumn()
    .Editor(true)
    .DataIndex("Reimbursed_Price")
    .Flex(1)
    .Text("Reimbursement Price")
    .Component(
    Html.X()
    .CheckboxGroup()
    .ColumnsNumber(1)
    .Height(80)
    .AutoScroll(true)
    .Listeners(ls => ls.Change.Fn = "SetDirty")
    .Items((from rd in (ViewBag.ChannelPriceTypes as List<PR.DTO.ChannelPriceTypeDTO>).ToList() where rd.CHANNEL_PRICE_TYPE_CD != 0 select new Ext.Net.Checkbox { ID = rd.CHANNEL_PRICE_TYPE_CD.ToString(), BoxLabel = rd.CHANNEL_PRICE_TYPE_DESC, RawValue = rd.CHANNEL_PRICE_TYPE_CD.ToString() }).ToList())
                                            )
    How do i set the selected checkboxes?
    The DataIndex("Reimbursed_Price") has comma separated values e.g. "1,5,8,9"

    Also,

    On post i have used StoreDataHandler to get changes records of gridpanel. Here the json submitted for checkboxlist is as follows;
    "Reimbursed_Price":{"checkbox-1105":"App.22","checkbox-1106":"App.21"}
    Thus, not working the the BatchObjectData() to which i specify my model class name i.e.
    var changeRecords = handler.BatchObjectData<PackPriceAttributesViewModelDTO>();
    Kindly provide your inputs for the same.
  4. #4
    I am not 100% sure a CheckboxGroup can be used with . Editor(true) setting, but it appears to be working.

    Example
    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "test", new { Checkbox1Name = false, Checkbox2Name = false } },
                    new object[] { "test", new { Checkbox1Name = true, Checkbox2Name = false } },
                    new object[] { "test", new { Checkbox1Name = true, Checkbox2Name = true } }
                };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:GridPanel ID="GridPanel1" runat="server">
                <Store>
                    <ext:Store runat="server">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="text" />
                                    <ext:ModelField Name="options" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column runat="server" Text="Text" DataIndex="text" />
    
                        <ext:ComponentColumn 
                            runat="server" 
                            Text="Options"
                            DataIndex="options" 
                            Width="300" 
                            Editor="true">
                            <Component>
                                <ext:CheckboxGroup runat="server">
                                    <Items>
                                        <ext:Checkbox                                         
                                            runat="server" 
                                            Name="Checkbox1Name"
                                            InputValue="1" 
                                            BoxLabel="Option 1">
                                            <CustomConfig>
                                                <ext:ConfigItem Name="useHiddenField" Value="false" Mode="Raw" /> <%-- To avoid submitting with a form --%>
                                            </CustomConfig>
                                        </ext:Checkbox>
    
                                        <ext:Checkbox 
                                            runat="server" 
                                            Name="Checkbox2Name" 
                                            InputValue="2" 
                                            BoxLabel="Option 2">
                                            <CustomConfig>
                                                <ext:ConfigItem Name="useHiddenField" Value="false" Mode="Raw" /> <%-- To avoid submitting with a form --%>
                                            </CustomConfig>
                                        </ext:Checkbox>
                                    </Items>
                                </ext:CheckboxGroup>
                            </Component>
                        </ext:ComponentColumn>
                    </Columns>
                </ColumnModel>
            </ext:GridPanel>
        </form>
    </body>
    </html>
    Last edited by Daniil; Sep 12, 2015 at 11:52 AM.
  5. #5
    Here is a related Ext.NET v3 discussion.
    http://forums.ext.net/showthread.php?60079

Similar Threads

  1. [CLOSED] Gridpanel component Column in CodeBehind
    By ebeker in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 07, 2013, 9:39 PM
  2. Replies: 2
    Last Post: Sep 24, 2013, 12:26 PM
  3. Replies: 2
    Last Post: Sep 13, 2013, 7:49 AM
  4. Replies: 4
    Last Post: Jul 05, 2013, 5:14 PM
  5. Replies: 2
    Last Post: Jun 27, 2013, 10:18 PM

Tags for this Thread

Posting Permissions