数据表水平滚动条不滚动表主体

时间:2018-07-03 04:43:46

标签: javascript jquery html datatables datatables-1.10

我有一个数据表水平滚动条,它在关闭后很奇怪地出现。 并且它仅滚动标题,而不滚动正文。 enter image description here

我想知道如何将滚动条移到表格的底部,并使正文而不是仅标题滚动。

下面是我的JS代码。

 var table = $('#myTable').DataTable( {
                scrollY:        200,
                scrollX : true,
                scrollCollapse: true,
                paging:         true,
                fixedColumns:   {
                    leftColumns: 1,
                }
            } );

我正在使用DataTables 1.10.19,FixedColumns 3.2.6,jQuery v3.2.1。 任何帮助是极大的赞赏。 我环顾了文档,没有用。

下面是我正在执行以显示视图的HTML / PHP。

<div class="table-responsive" id="wrappertable">

       <table class="table table-responsive table-condensed" id="myTable" style="width:100%">
                                    <thead class="thead-light">
                                    <tr>
                                        <th scope="col">Question</th>
                                        <th scope="col">Answer</th>
                                        @foreach($products as $product)
                                            <th scope="col">{{ $product->productName }}</th>
                                        @endforeach
                                    </tr>
                                    </thead>
                                    <tbody id="thebody ">
                                            @foreach($questions as $question)
                                                @if($question->question->answerType ==  2 || $question->question->answerType ==  3)

                                                    @foreach($question->answers as $answer)
                                                        <tr>
                                                            <td class="text-left"><strong>{{ $question->question->questiontext }}</strong></td>
                                                            <td class="text-right">{{ $answer->option_text }}</td>
                                                            @foreach($products as $product)
                                                                <td>
                                                                    <input type="hidden" name="products[]" value="{{ $product->id }}"/>
                                                                    <input type="hidden" name="answer[]" value="{{ $answer->id }}"/>
                                                                    <?php $mark = 0; ?>
                                                                    @foreach($matrix as $m)
                                                                        @if($m->answer == $answer->id && $m->product == $product->id)
                                                                            <?php $mark = $m->points; ?>
                                                                        @endif
                                                                    @endforeach
                                                                    <input class="mypoints" type="number" required max="5" min="-1000" name="points[]" value="{{ $mark }}"/>
                                                                </td>
                                                            @endforeach
                                                        </tr>
                                                    @endforeach
                                                @endif
                                            @endforeach
                                    </tbody>
                                </table>


                        </div>

0 个答案:

没有答案