Ext.NET中的复选框问题

时间:2014-04-17 07:44:50

标签: javascript jquery asp.net ext.net

我正在运行时,复选框显示为按钮.. 我的'company.ascx'代码是这样的:

<ext:FormPanel LabelWidth="160" runat="server" ID="CompanyFormPanel" Border="false" IDMode="Static" Padding="10"  Width="1000" Layout="ColumnLayout"  Height="480">
        <Items>
            <ext:FieldSet ID="companyPanel1" runat="server" IDMode="Static" Layout="Form" Border="false" >
            <Defaults>
                <ext:Parameter Name="LabelSeparator" Value=" " />                    
                <ext:Parameter Name="LabelWidth" Value="160" />                    
                <ext:Parameter Name="Width" Value="360" />         
            </Defaults>
                <Items>                   

                   <ext:TextField ID="txtCompanyLoginCode" AllowBlank="false" runat="server" IDMode="Static" Name="CompanyLoginCode" 
                       FieldLabel="Company Login Code"  >                           
                   </ext:TextField>               

                   <ext:TextField ID="txtCompanyTaxID" runat="server" IDMode="Static" Name="CompanyTaxID" FieldLabel="Company TaxID"></ext:TextField>

                   <ext:TextField ID="txtCompanyName" runat="server" IDMode="Static" Name="CompanyName" AllowBlank="false" FieldLabel="Company Name" ></ext:TextField>
                   <ext:TextField ID="txtCompanyAddressLine1" runat="server" IDMode="Static" Name="CompanyAddressLine1"  FieldLabel="Company Address Line1" ></ext:TextField>
                   <ext:TextField ID="txtCompanyAddressLine2" runat="server" IDMode="Static" Name="CompanyAddressLine2" FieldLabel="Company Address Line2"></ext:TextField>

                   <ext:TextField ID="txtComCity" runat="server" IDMode="Static" Name="City" FieldLabel="City" ></ext:TextField>                                            

                 <ext:ComboBox AllowBlank="false" ID="cmbCountries" runat="server" FieldLabel="County" 
                                    Name="CountyCode" ValueField="CountyCode" TypeAhead="true" QueryMode="Local" 
                                    DisplayField="CountyName" StoreID="dsCountries" IDMode="Static">                       
                 </ext:ComboBox> 

                <ext:ComboBox AllowBlank="false" ID="cmbStates" runat="server" FieldLabel="State" 
                    Name="StateCode" ValueField="StateCode" DisplayField="StateCode" QueryMode="Local" 
                    StoreID="dsStates" IDMode="Static"  TypeAhead="true">    

                </ext:ComboBox>                        

                <ext:TextField ID="txtE_Mail" runat="server" IDMode="Static" Name="E_Mail" FieldLabel="Email"  ></ext:TextField>
                 <ext:TextField ID="txtComPhoneNo" runat="server" IDMode="Static" Name="PhoneNo" FieldLabel="PhoneNo" ></ext:TextField>
                 <ext:TextField ID="txtFax" runat="server" IDMode="Static" Name="Fax" FieldLabel="Fax" ></ext:TextField>
                 <ext:TextField AllowBlank="false" ID="txtSyncUser" runat="server" IDMode="Static" Name="SyncUser" FieldLabel="SyncUser"></ext:TextField>
                 <ext:TextField AllowBlank="false" ID="txtSyncPwd" runat="server" IDMode="Static" Name="SyncPwd" FieldLabel="SyncPwd" ></ext:TextField>                 
                 <ext:Checkbox ID="chkEnableMobLogging" Type="Checkbox" runat="server" Name="EnableMobileLogging" IDMode="Static" FieldLabel="Enable Mobile Logging"></ext:Checkbox>                                                                                             
                 <ext:Checkbox ID="chkIsInPosSyncStatus" runat="server" Name="IsInPOSSyncStatus" IDMode="Static" FieldLabel="See Data in POS Sync Status"></ext:Checkbox>    
                </Items>
            </ext:FieldSet>

        </Items>
    </ext:FormPanel>

当我运行项目时,html代码显示如下:

<input type="button" hidefocus="true" autocomplete="off" class="x-form-field x-form-checkbox" id="chkEnableMobLogging-inputEl" aria-invalid="false" data-errorqtip="">

此处type显示为按钮。它需要是CheckBox。我可以知道它为什么会改变以及如何将其作为复选框吗?

1 个答案:

答案 0 :(得分:1)

原因是跨浏览器兼容性。

Ext.NET/ExtJS将复选框呈现为

<input type="button">

可以使用相同的视图为所有浏览器设置样式。使用原生复选框是不可能的。

您可以在FireFox和Chrome中尝试使用原生复选框,看看它们看起来有多么不同。

但是,如果启用了ARIA,则应该有&#34;复选框&#34;,the ExtJS sources中有这样的评论(搜索&#34; ARIA&#34;):

那么,请在&#34;复选框&#34;中澄清您需要的原因是什么?