Home Web Front-end JS Tutorial How to implement Table search box and query in Bootstrap

How to implement Table search box and query in Bootstrap

Jun 23, 2018 pm 03:05 PM
bootstrap table Inquire

This article mainly introduces the Bootstrap Table search box and query function. It is very good and has reference value. Friends in need can refer to it

1.. Knowledge points bootstrapTable refresh and query configuration

2. Improve js code performance

1. Reduce global variable declarations

2. Cache dom node search results

3. Local variables cache global variables

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

/**

 * @param col bootstrapTable列表生成配置对象

 */

var searchValue ={};//查询匹配对象

var $button = $(&#39;<p class="columns pull-right search-button"><button class="btn btn-default" type="button" name="refresh" title="查询"><i class="glyphicon glyphicon-search icon-search"></i></button></p>&#39;);

var $input = $(&#39;<p class="columns pull-right search-input"><input class="form-control" type="text" placeholder="搜索"></p>&#39;);

var $select = $(&#39;<p class="columns pull-right search-select"><select></select></p>&#39;);

var addSearchGroup = function(col)

{

   // 插入选项

   var button ,input,select;

   button = $button;input = $input;select = $select;////局部变量缓存全局变量 提高代码性能

   var selectDom = $select.find(&#39;select&#39;);////缓存dom节点查找结果 避免在循环里用

   for(var i = 0; i < col.length; i++){

     if(col[i].visible != false){

       var $option = &#39;<option value="&#39;+col[i].field+&#39;">&#39;+col[i].title+&#39;</option>&#39;;

       selectDom.append($option);

     }

   }

   //插入多选框、输入框、按钮

   $(&#39;.fixed-table-toolbar&#39;).append(button,input,select);

}

/*

button = $button

*/

searchAction($button);

function searchAction(button){

  //写入上一次查询的条件

   if(searchValue.select != undefined){

     $select.find(&#39;select&#39;).val(searchValue.select);

   };

   if(searchValue.input != undefined){

     $input.find(&#39;input&#39;).val(searchValue.input);

   };

   //写入查询条件

   // 获取查询选项

   button.click(function(){

      var option = $select.find(&#39;select&#39;).val();

      var inputval = $input.find(&#39;input&#39;).val();

      searchValue.select =option;

      searchValue.inputval =inputval;

   //定义刷新参数

     if(inputval != &#39;&#39;){

       var param = {

         url: sWebRootPath+"/json/getAjaxData.jsp?v="+new Date().getTime(),

         query: {

           filters:[

             {&#39;colname&#39;:option,&#39;filtertype&#39;:&#39;LIKE&#39;,&#39;filtervalues&#39;:inputval}

           ]

         }

       }

     }else{

       var param = {

        url: sWebRootPath+"/json/getAjaxData.jsp?v="+new Date().getTime(),

       }

     }

      // 刷新表格

    $(&#39;#tablelist&#39;).bootstrapTable(&#39;refresh&#39;,param);

    });

}

Copy after login

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to use slider to set data value in WeChat mini program

How to achieve pop-up bottom in WeChat mini program Menu

How to use the toast message dialog box in the WeChat applet

How to use the loading component to display the loading animation in the WeChat applet

The above is the detailed content of How to implement Table search box and query in Bootstrap. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to check your academic qualifications on Xuexin.com How to check your academic qualifications on Xuexin.com Mar 28, 2024 pm 04:31 PM

How to check my academic qualifications on Xuexin.com? You can check your academic qualifications on Xuexin.com, but many users don’t know how to check their academic qualifications on Xuexin.com. Next, the editor brings you a graphic tutorial on how to check your academic qualifications on Xuexin.com. Interested users come and take a look! Xuexin.com usage tutorial: How to check your academic qualifications on Xuexin.com 1. Xuexin.com entrance: https://www.chsi.com.cn/ 2. Website query: Step 1: Click on the Xuexin.com address above to enter the homepage Click [Education Query]; Step 2: On the latest webpage, click [Query] as shown by the arrow in the figure below; Step 3: Then click [Login Academic Credit File] on the new page; Step 4: On the login page Enter the information and click [Login];

How to introduce bootstrap into Eclipse How to introduce bootstrap into Eclipse Apr 05, 2024 am 02:30 AM

Introduce Bootstrap in Eclipse in five steps: Download the Bootstrap file and unzip it. Import the Bootstrap folder into the project. Add Bootstrap dependency. Load Bootstrap CSS and JS in HTML files. Start using Bootstrap to enhance your user interface.

12306 How to check historical ticket purchase records How to check historical ticket purchase records 12306 How to check historical ticket purchase records How to check historical ticket purchase records Mar 28, 2024 pm 03:11 PM

Download the latest version of 12306 ticket booking app. It is a travel ticket purchasing software that everyone is very satisfied with. It is very convenient to go wherever you want. There are many ticket sources provided in the software. You only need to pass real-name authentication to purchase tickets online. All users You can easily buy travel tickets and air tickets and enjoy different discounts. You can also start booking reservations in advance to grab tickets. You can book hotels or special car transfers. With it, you can go where you want to go and buy tickets with one click. Traveling is simpler and more convenient, making everyone's travel experience more comfortable. Now the editor details it online Provides 12306 users with a way to view historical ticket purchase records. 1. Open Railway 12306, click My in the lower right corner, and click My Order 2. Click Paid on the order page. 3. On the paid page

How to read the bootstrap mediation effect test results in stata How to read the bootstrap mediation effect test results in stata Apr 05, 2024 am 01:48 AM

Interpretation steps of Bootstrap mediation effect test in Stata: Check the sign of the coefficient: Determine the positive or negative direction of the mediation effect. Test p value: less than 0.05 indicates that the mediating effect is significant. Check the confidence interval: not containing zero indicates that the mediation effect is significant. Comparing the median p-value: less than 0.05 further supports the significance of the mediation effect.

How to introduce idea into bootstrap How to introduce idea into bootstrap Apr 05, 2024 am 02:33 AM

Steps to introduce Bootstrap in IntelliJ IDEA: Create a new project and select "Web Application". Add "Bootstrap" Maven dependency. Create an HTML file and add Bootstrap references. Replace with the actual path to the Bootstrap CSS file. Run the HTML file to use Bootstrap styles. Tip: Use a CDN to import Bootstrap or customize HTML file templates.

750,000 rounds of one-on-one battle between large models, GPT-4 won the championship, and Llama 3 ranked fifth 750,000 rounds of one-on-one battle between large models, GPT-4 won the championship, and Llama 3 ranked fifth Apr 23, 2024 pm 03:28 PM

Regarding Llama3, new test results have been released - the large model evaluation community LMSYS released a large model ranking list. Llama3 ranked fifth, and tied for first place with GPT-4 in the English category. The picture is different from other benchmarks. This list is based on one-on-one battles between models, and the evaluators from all over the network make their own propositions and scores. In the end, Llama3 ranked fifth on the list, followed by three different versions of GPT-4 and Claude3 Super Cup Opus. In the English single list, Llama3 overtook Claude and tied with GPT-4. Regarding this result, Meta’s chief scientist LeCun was very happy and forwarded the tweet and

How to use bootstrap to test mediation effects How to use bootstrap to test mediation effects Apr 05, 2024 am 03:57 AM

The Bootstrap test uses resampling technology to evaluate the reliability of the statistical test and is used to prove the significance of the mediation effect: first, calculate the confidence interval of the direct effect, indirect effect and mediation effect; secondly, calculate the significance of the mediation type according to the Baron and Kenny or Sobel method. significance; and finally estimate the confidence interval for the natural indirect effect.

How to read the results of bootstrap mediation test How to read the results of bootstrap mediation test Apr 05, 2024 am 03:30 AM

The Bootstrap mediation test evaluates the mediation effect by resampling the data multiple times: Indirect effect confidence interval: indicates the estimated range of the mediation effect. If the interval does not contain zero, the effect is significant. p-value: Evaluates the probability that the confidence interval does not contain zero, with values ​​less than 0.05 indicating significant. Sample size: The number of data samples used for analysis. Bootstrap subsampling times: the number of repeated samplings (500-2000 times). If the confidence interval does not contain zero and the p-value is less than 0.05, the mediation effect is significant, indicating that the mediating variable explains the relationship between the independent and dependent variables.

See all articles