Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension filter-control, do not set search field #3966

Closed
TiedtTech opened this issue Sep 5, 2018 · 6 comments
Closed

Extension filter-control, do not set search field #3966

TiedtTech opened this issue Sep 5, 2018 · 6 comments
Assignees
Labels
duplicate Issues that are duplicated with other issues.

Comments

@TiedtTech
Copy link

I added the filter-control extension.
My grid is configured below.

As the data comes from the server, the data-query-params="parametrosDaConsulta" is configured like this:

function parametrosDaConsulta(params) {

    console.log(params);

    return {
        filtroCampos: params.filter,
        itensPorPagina: params.limit,
        itensParaIgnorar: params.offset,
        filtro: params.search,
        orderna: params.sort,
        ordernaTipo: params.order,
        tipoPesquisa: $(this).attr("tipopesquisa"),
        registroPaiID: $("#" + $(this).attr("registropaiid")).val()
    }; 
};

My problem, when filtering the column, the plugin correctly sends the data filter parameter being "field": "value".

However in the search parameter, the value of the field value is sent.

My question

How do I make the filter-control plugin not set the search value?

My table config

<table id="table"
       data-toggle="table"
       data-url="/Ajax/Grid/"
       data-side-pagination="server"
       data-pagination="true"
       data-page-list="[5, 10, 20, 50, 100, 200, 500]"
       data-search="true"
       data-filter-control="true"
       data-show-refresh="true"
       data-show-toggle="true"
       data-show-columns="true"
       data-query-params="parametrosDaConsulta"
       data-locale="pt-BR"
       data-search-on-enter-key="true"
       data-row-style="estiloDaLinha"
       data-toolbar="#exportarGrid"
       data-tipopesquisa="OperacaoPlanoLocalidade">
    <thead>
        <tr>
            <th data-field="OperacaoPlanoLocalidadeID" data-sortable="true" data-visible="false" data-width="96px">ID</th>
            <th data-field="Nome" data-width="288px" data-sortable="true" data-filter-control="select" data-filter-data="var:clientes" data-search-on-enter-key="true">Cliente</th>
            <th data-field="Plano" data-sortable="true">Plano</th>
            <th data-field="Localidade" data-sortable="true">Localidade</th>
            @Html.Partial(@MTSys.Lib.Constantes.gridPadraoCamposFixos)
            <th data-field="botoes" data-width="48px" data-registroid="OperacaoPlanoLocalidadeID" data-controller="OperacaoPlanoLocalidade" data-formatter="adicionarBotaoEdicao" data-niveldeacesso="@nivelDeAcesso"></th>
        </tr>
    </thead>
</table>
@jimgit
Copy link

jimgit commented Sep 9, 2018

Please place your code in a jsfiddle

@mriddle
Copy link

mriddle commented Nov 27, 2018

@mriddle
Copy link

mriddle commented Nov 27, 2018

It's due to onColumnSearch calling this.onSearch(event). The search text is set to the value of the column you're filtering on.

You can hack it by changing the target with

event.currentTarget = this.$toolbar.find('.search input')[0]
this.onSearch(event);

or by using customSearch

@mriddle
Copy link

mriddle commented Nov 28, 2018

Related: #3015

@mriddle
Copy link

mriddle commented Nov 28, 2018

Related: #2776

@djhvscf djhvscf self-assigned this Dec 4, 2018
@UtechtDustin
Copy link
Collaborator

Duplicate #2776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues that are duplicated with other issues.
Projects
None yet
Development

No branches or pull requests

5 participants