搜索功能在烧瓶模型视图屏幕中不起作用

时间:2019-08-29 08:51:40

标签: flask flask-sqlalchemy flask-appbuilder

我在modelviews中有一个数据表。当我尝试使用搜索栏时,它返回“找不到匹配的记录”。我试图通过list.html纠正此问题,但没有任何效果。

{%将'appbuilder / general / lib.html'导入为lib%} {%扩展了'appbuilder / general / widgets / base_list.html'%}

{% block begin_content scoped %}
    <br>
    <div class="table-responsive">
        <table id="table_id" class="display" style="display:none;table-layout:fixed">
            {% endblock %}

            {% block begin_loop_header scoped %}
            <thead>
                <tr>
                    {% if actions %}
                    <th class="action_checkboxes">
                        <input id="check_all" class="action_check_all" name="check_all" type="checkbox">
                    </th>
                    {% endif %}

                    {% if can_show or can_edit or can_delete %}
                    <th class="col-md-1 col-lg-1 col-sm-1"></th>
                    {% endif %}

                    {% for item in include_columns %}
                    {% if item in order_columns %}
                    {% set res = item | get_link_order(modelview_name) %}
                    {% if res == 2 %}
                    <th>
                        <a href={{ item | link_order(modelview_name) }}>
                            {{label_columns.get(item)}}
                            <i class="fa fa-chevron-up pull-right"></i>
                        </a>
                    </th>
                    {% elif res == 1 %}
                    <th>
                        <a href={{ item | link_order(modelview_name) }}>
                            {{label_columns.get(item)}}
                            <i class="fa fa-chevron-down pull-right"></i>
                        </a>
                    </th>
                    {% else %}
                    <th>
                        <a href={{ item | link_order(modelview_name) }}>
                            {{label_columns.get(item)}}
                            <i class="fa fa-arrows-v pull-right"></i>
                        </a>
                    </th>
                    {% endif %}
                    {% else %}
                    <th>{{label_columns.get(item)}}</th>
                    {% endif %}
                    {% endfor %}
                </tr>
            </thead>
            {% endblock %}

            {% block begin_loop_values %}
            {% for item in value_columns %}
            {% set pk = pks[loop.index-1] %}
            <tr>
                {% if actions %}
                <td>
                    <input id="{{pk}}" class="action_check" name="rowid" value="{{pk}}" type="checkbox">
                </td>
                {% endif %}
                {% if can_show or can_edit or can_delete %}
                <td>
                    <center>
                        {{ lib.btn_crud(can_show, can_edit, can_delete, pk, modelview_name, filters) }}
                    </center>
                </td>
                {% endif %}
                {% for value in include_columns %}
                {% set formatter = formatters_columns.get(value) %}
                {% if formatter %}
                <td>{{ formatter(item[value]) }}</td>
                {% else %}
                <td>{{ item[value] }}</td>
                {% endif %}
                {% endfor %}
            </tr>
            {% endfor %}
            {% endblock %}

            {% block begin_loop_footer scoped %}
            <tfoot>
                <tr>
                    {% if actions %}
                    <th class="action_checkboxes">
                        <input id="check_all" class="action_check_all" name="check_all" type="checkbox">
                    </th>
                    {% endif %}

                    {% if can_show or can_edit or can_delete %}
                    <th class="col-md-1 col-lg-1 col-sm-1"></th>
                    {% endif %}

                    {% for item in include_columns %}
                    {% if item in order_columns %}
                    {% set res = item | get_link_order(modelview_name) %}
                    {% if res == 2 %}
                    <th>
                        <a href={{ item | link_order(modelview_name) }}>
                            {{label_columns.get(item)}}
                            <i class="fa fa-chevron-up pull-right"></i>
                        </a>
                    </th>
                    {% elif res == 1 %}
                    <th>
                        <a href={{ item | link_order(modelview_name) }}>
                            {{label_columns.get(item)}}
                            <i class="fa fa-chevron-down pull-right"></i>
                        </a>
                    </th>
                    {% else %}
                    <th>
                        <a href={{ item | link_order(modelview_name) }}>
                            {{label_columns.get(item)}}
                            <i class="fa fa-arrows-v pull-right"></i>
                        </a>
                    </th>
                    {% endif %}
                    {% else %}
                    <th>{{label_columns.get(item)}}</th>
                    {% endif %}
                    {% endfor %}
                </tr>
            </tfoot>
            {% endblock %}

            {% block end_content scoped %}
        </table>
    </div>
{% endblock %}

我希望搜索栏返回准确的结果。

0 个答案:

没有答案