question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The value entered in the global search field is overwritten by the value entered in the column search field

See original GitHub issue

Bootstraptable version(s) affected

1.18.3

Description

There is a table with the following parameters: data-cookie="true" data-cookie-id-table="tblItemsObjLvl" data-locale="sv-SE" data-toggle="table" data-show-export="true" data-export-options='{"fileName": "BuildID_objektlista"}' data-export-types="['json', 'csv', 'excel']" data-pagination="true" data-page-size="25" data-side-pagination="server" data-click-to-select="true" data-buttons-class="success" data-buttons-toolbar=".buttons-toolbar" data-toolbar="#toolbar" data-show-toggle="false" data-show-columns="true" data-ajax="ajaxRequest" data-filter-control="true" data-show-search-clear-button="true" data-detail-view="true" data-search="true" The table has a columns with data-filter-control set to select and input. For columns with data-filter-control = select, a caching variable is set via the data-filter-data parameter. The table has global search enabled - data-search="true" Data is loaded via ajax request.

When entering data into the global search field, the text from the global search field is passed to the ajaxRequest function (which is specified in the data-ajax parameter) in the search field of the input object of the function. Example: { cache: true contentType: “application/json” data: { limit: 25 offset: 0 order: “asc” search: “123” sort: “SubSiteName” } dataType: “json” error: ƒ (e) success: ƒ (e,i,n) type: “get” }

Everything is fine When a value is selected from the dropdown list (data-filter-control = select) in a column - the same everything is fine. The selected value is added to the JSON string in the filter key in the input object of the ajaxRequest function Example: { cache: true contentType: “application/json” data: { filter: “{"ConstructionStatus":"1"}” limit: 25 offset: 0 order: “asc” search: “123” sort: “SubSiteName” } dataType: “json” error: ƒ (e) success: ƒ (e,i,n) type: “get” }

But when I enter a value in the input field in the column (data-filter-control = input), the value that I enter is added both to the JSON string in the filter key and in the search key, overwriting the value that was there (in the search key,). Example: { cache: true contentType: “application/json” data: { filter: “{"ConstructionStatus":"1","supplier_old":"test"}” limit: 25 offset: 0 order: “asc” search: “test” sort: “SubSiteName” } dataType: “json” error: ƒ (e) success: ƒ (e,i,n) type: “get” }


There is also a nuance with caching. The value entered in the global input field is cached into the same variable as the value entered in the search field in the column. They grind one by one. In my case, this is the tblItemsObjLvl.bs.table.searchText variable

At the same time, when trying to set a variable for loading data using the data-filter-data parameter, an error:

bootstrap-table-filter-control.min.js:10 Uncaught TypeError: Cannot read properties of undefined (reading ‘length’) at bootstrap-table-filter-control.min.js:10:23769 at bn (bootstrap-table-filter-control.min.js:10:23844) at Object.<anonymous> (bootstrap-table-filter-control.min.js:10:28335) at Function.each (jquery.min.js:2:3003) at En (bootstrap-table-filter-control.min.js:10:26822) at p.value (bootstrap-table-filter-control.min.js:10:35599) at p.value (bootstrap-table.min.js:10:107140) at p._toggleColumn (bootstrap-table-cookie.js:2367:87) at HTMLInputElement.<anonymous> (bootstrap-table.min.js:10:69092) at HTMLInputElement.dispatch (jquery.min.js:2:43064)

Code example: data-filter-data = "var:input"

Example(s)

No response

Possible Solutions

No response

Additional Context

In project use admin-lte: 3.1.0 Update the table to 1.19.1 version not fixed this problem

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
djhvscfcommented, Apr 29, 2022

I think this is fixed in the latest version. Can you confirm https://live.bootstrap-table.com/code/djhvscf/11358? @vladimirruzhyn

0reactions
UtechtDustincommented, May 13, 2022

Seems fixed for me, if it is still not fixed for you @vladimirruzhyn then please let us know how we can reproduce it and we will reopen the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set default values for fields or controls - Microsoft Support
Select the lookup field, and on the General tab, in the Default Value property box, type the key value that you noted in...
Read more >
NetSuite Applications Suite - Including Custom Fields in ...
Text Area. Global search results that include multiple record types include a Custom Fields column that lists the custom field name and value...
Read more >
Define a dictionary override
Use a dictionary override to allow a field in a child table to have a different value or behavior than the same field...
Read more >
Create field aliases in Splunk Web
Splunk software applies field aliases to a search after it performs key-value field extraction, but before it processes calculated fields, lookups, event types, ......
Read more >
Managing Globals | InterSystems IRIS Data Platform 2022.2
If you are looking for a particular global and do not initially see its name: Optionally specify a search mask. To do so,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found