bootstrap table editing cell (code example)
This time I will bring you bootstrap table editing cells. What are the precautions for bootstrap table editing cells? The following is a practical case, let’s take a look.
[Related video recommendation: Bootstrap tutorial]
To make bootstrap-table editable, you need to use the x-editable plug-in.
First import the necessary css and js files on the page
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <title>bootstrap-table demo</title> <!-- Bootstrap 3.3.6 --> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" rel="external nofollow" > <!-- Bootstrap table --> <link rel="stylesheet" href="bootstrap-table-1.11.0/bootstrap-table.css" rel="external nofollow" > <!-- x-editable --> <link rel="stylesheet" href="x-editable/bootstrap3-editable/css/bootstrap-editable.css" rel="external nofollow" > </head> <body> <div class="container"> <p></p> <table id="table" class="table table-bordered table-hover"> </table> </div> <!-- jQuery 2.2.0 --> <script src="jQuery-2.2.0.min.js"></script> <!-- Bootstrap 3.3.6 --> <script src="bootstrap/js/bootstrap.min.js"></script> <!-- bootstrap table --> <script src="bootstrap-table-1.11.0/bootstrap-table.js"></script> <script src="bootstrap-table-1.11.0/extensions/editable/bootstrap-table-editable.js"></script> <script src="x-editable/bootstrap3-editable/js/bootstrap-editable.js"></script> <script src="bootstrap-table-1.11.0/locale/bootstrap-table-zh-CN.min.js"></script> <script type="text/javascript"> $(function(){ $('#table').bootstrapTable({ url:'data.json', columns:[ {field: 'id',title: 'ID'}, {field: 'name',title: '名称'}, {field: 'price',title: '单价'}, {field: 'number',title: '数量', sortable:true, cellStyle:function(value,row,index) { return { "css":{ padding:'0px' } }; }, formatter:function(value,row,index){ if(value == undefined) return "0"; else return value; }, editable:{ type:'text', clear:false, validate:function(value){ if(isNaN(value)) return {newValue:0, msg:'只允许输入数字'}; else if(value<0) return {newValue:0, msg:'数量不能小于0'}; else if(value>=1000000) return {newValue:0, msg:'当前最大只能输入999999'}; }, display:function(value){ $(this).text(Number(value)); }, //onblur:'ignore', showbuttons:false, defaultValue:0, mode:'inline' } }, {field:'amount', title: '总价'} ], //height:300, idField:'id', onEditableHidden: function(field, row, $el, reason) { // 当编辑状态被隐藏时触发 if(reason === 'save') { var $td = $el.closest('tr').children(); $td.eq(-1).html((row.price*row.number).toFixed(2)); $el.closest('tr').next().find('.editable').editable('show'); //编辑状态向下一行移动 } else if(reason === 'nochange') { $el.closest('tr').next().find('.editable').editable('show'); } } }); $('#table').on( 'click', 'td:has(.editable)', function (e) { //e.preventDefault(); e.stopPropagation(); // 阻止事件的冒泡行为 $(this).find('.editable').editable('show'); // 打开被点击单元格的编辑状态 } ); }); </script> </body> </html>
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
JS implements simple four arithmetic operations
JS implements drop-down menu login registration pop-up window
The above is the detailed content of bootstrap table editing cell (code example). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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.

Is it frustrating to automatically remove leading zeros from Excel workbooks? When you enter a number into a cell, Excel often removes the leading zeros in front of the number. By default, it treats cell entries that lack explicit formatting as numeric values. Leading zeros are generally considered irrelevant in number formats and are therefore omitted. Additionally, leading zeros can cause problems in certain numerical operations. Therefore, zeros are automatically removed. This article will teach you how to retain leading zeros in Excel to ensure that the entered numeric data such as account numbers, zip codes, phone numbers, etc. are in the correct format. In Excel, how to allow numbers to have zeros in front of them? You can preserve leading zeros of numbers in an Excel workbook, there are several methods to choose from. You can set the cell by

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.

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.

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

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.

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.

If you encounter the problem of numbers being automatically changed to dates in Excel, or dates turning into random numbers, this article will provide solutions. Some users reported that when they entered numbers, the numbers automatically turned into dates. This problem is usually caused by cell formatting. Excel keeps changing numbers to latest If numbers in Microsoft Excel keep changing to dates, you can fix this problem by formatting the cells as text. Insert an apostrophe before the number. Use Paste Special. 1] Format cells as text To prevent Excel from automatically adjusting number formats, you first need to change the format of the relevant cells to text. Here are the simple steps to do this: First, numerically select all
