本文介绍了如何过滤表格列但不是全部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用angularjs和typescript,我无法根据搜索词过滤表记录。它仅适用于一列。



我尝试过:



这是我的视图,您可以在其中输入搜索词



I've been using angularjs and typescript and i'm unable to filter table records depending on the search word. it works for only one column.

What I have tried:

this is my view where you can input the search word

<input class="form-control" type="text" id="search" placeholder="" ng-model="Text" aria-controls="able_col_reorder">










 <table class="table table-bordered" ng-show="!faqList.IsNull" @*id="datatable_col_reorder"*@>

this is the table where i want to filter records from both answer and question
                         <thead>
                                            <tr>
                                                <th style="width: 10%"></th>
                                                <th style="width: 40%">Question</th>
                                                <th style="width:10%">Created By</th>
                                                <th style="width: 10%">Posted Date</th>

                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr class="ng-cloak" ng-repeat-start="item in faqList | filter: {Question:Text} "  ng-hide="(item.IsActive == false) && Checked" ng-cloak>
                                                <td>
                                                    <a class="panel-heading" role="tab"
                                                       id="headingOne" data-toggle="collapse"
                                                       data-parent="#accordion" ng-href="#{{item.Id}}"
                                                       aria-expanded="true" aria-controls="test_div">
                                                        Answer
                                                    </a>
                                                </td>
                                                <td><a href="@Url.Action("index", "Create")?Id={{item.Id}}">{{item.Question}}</a></td>
                                                <td>{{item.CreatedBy}}</td>
                                                <td>{{item.PostedDate | date :'MMM dd, yy'}}</td>

                                            </tr>
                                            <tr ng-repeat-end>
                                                <td colspan="10">
                                                    <div id="{{item.Id}}" class="panel-collapse collapse" role="tabpanel">
                                                        <table class="table table-bordered">
                                                            <thead>
                                                                <tr>
                                                                    <th></th>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                                <tr class="ng-cloak" ng-cloak>
                                                                    <td><div ng-bind-html="item.FaqAnswer"></div></td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </td>
                                            </tr>
                                        </tbody>

                                    </table>

推荐答案


这篇关于如何过滤表格列但不是全部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 11:26