Bootstrap DataTable:不在<input />字段内搜索

时间:2017-09-13 10:08:57

标签: jquery twitter-bootstrap

我正在尝试使用DataTable的功能,并且我遇到以下问题:

这是表格中显示的数据示例:

enter image description here

可以看出,在第一列(&#34; Serial&#34;)中,有两种情况以KD开头。将尝试搜索它们:

enter image description here

在结果中,没有找到它们,我想知道如何解决这个问题。作为旁注,此列标记为&#39; readonly&#39;但那不是问题。

这是构造表的代码:

<table id="management" class="table table-bordered table-hover" >
    <thead>
        <tr>
            <th hidden>Hidden</th>
            <th class="col-md-3">Serial</th>
            <th class="col-md-2">Tienda</th>
            <th class="col-md-1">Precio</th>
            <th class="col-md-2">Estado</th>
            <th class="col-md-1">Update</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td hidden  >
                    <form id="@(String.Format("{0}{1}","form",item.Id))" asp-action="Management" asp-route-id="@item.Id" method="post">
                    </form>
                </td>
                <td class="col-md-3">
                    <input form="@(String.Format("{0}{1}","form",item.Id))" type="hidden" asp-for="@item.Id" />
                    <div class="form-group" form="@(String.Format("{0}{1}","form",item.Id))">
                        <div>
                            <input form="@(String.Format("{0}{1}","form",item.Id))" asp-for="@item.MchName" name="MchName" readonly class="form-control" />
                            <span asp-validation-for="@item.MchName" class="text-danger"></span>
                        </div>
                    </div>
                </td>
                <td class="col-md-2">
                        <div class="form-group" form="@(String.Format("{0}{1}","form",item.Id))">
                            <div>
                                <select asp-for="@item.StoreID" name="StoreID" class="form-control" asp-items="ViewBag.StoreID" form="@(String.Format("{0}{1}","form",item.Id))"></select>
                                <span asp-validation-for="@item.StoreID" class="text-danger"></span>
                            </div>
                        </div>
                </td>
                <td class="col-md-1">
                        <div class="form-group" form="@(String.Format("{0}{1}","form",item.Id))">
                            <div>
                                <input type="number" max="10" min="0" step=".5" asp-for="@item.PUnit" name="PUnit" class="form-control" form="@(String.Format("{0}{1}","form",item.Id))" />
                                <span asp-validation-for="@item.PUnit" class="text-danger"></span>
                            </div>
                        </div>
                </td>
                <td class="col-md-2">
                        <div class="form-group" form="@(String.Format("{0}{1}","form",item.Id))">
                            <div>
                                <select name="Status" asp-for="@item.MachineStatus" class="form-control" form="@(String.Format("{0}{1}","form",item.Id))">
                                    <option value="0">Operativo</option>
                                    <option value="1">Nuevo Item</option>
                                    <option value="2">Reparación</option>
                                </select>
                                <span asp-validation-for="@item.MachineStatus" class="text-danger"></span>
                            </div>
                        </div>
                </td>
                <td class="col-md-1">
                        <input form="@(String.Format("{0}{1}","form",item.Id))" id="submit-data" type="submit" value="Update" class="btn btn-default" />
                </td>
            </tr>}
    </tbody>
</table>

DataTable的脚本:

<script>
        $("#management").DataTable();
</script>

这是构造行的代码:

enter image description here

此外,尝试手动添加一行,手动编写简单文本并成功过滤。 也许没有任何内容可以阅读?

0 个答案:

没有答案