Jquery DataTable 中控件的列宽,用于 jquery datatable 的纯 css



我的表正在使用TwitterBootstrap:

   <table id="sDetails" class="table table-bordered table-striped table-hover dataTable">
                <thead>
                    <tr>
                        <th>Item</th>
                        <th>Checked</th>
                        <th>Comments</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach(var item in m.Items)
                     {
                     <tr>
                        <td>@Html.HiddenFor(m => m.ItemKey)
                            @Html.DisplayFor(m => m.Item)
                        </td>
                        <td>@Html.CheckBoxFor(m => m.IsChecked)</td>
                        <td>@Html.TextBoxFor(m => m.Comments)</td>
                     </tr>
                     }
                </tbody>
            </table>
<script>
 $(document).ready(function () {          /* Init the table*/
             $("#sDetails").dataTable({
                 "bFilter": false,
                 "bLengthChange": false,
                 "bRetrieve": false,
                 "bSortClasses": false,
                 "bPaginate": false,
                 "bInfo": false,
                 "bJQueryUI": false,
                 "bAutoWidth": false,
                 "aDataSort": false,
                 "asSorting": false,
                 "bSortable": false,
                 "aoColumns": [{ "sDom": false, "bSortable": false, sWidth: '15%' }, { "sDom": false, "bSortable": false, sWidth: '5%' }, { "sDom": false, "bSortable": false, sWidth: '80%' }]
            });
</script>

1)如何指定文本框控件的宽度?2) 如何删除 jQuery 数据表的 CSS?(即在此表上)- 谷歌浏览器中的表格上没有CSS,但是IE中的表格上应用了一些默认的CSS。

要将 css 应用于TextBox,要么全局将样式应用于 css 文件中的所有文本框,要么使用 @Html.TextBoxFor 中的最后一个参数 HtmlAttributes 并应用样式。

要在所有浏览器中重置为默认 css,请使用样板。

最新更新