This section mainly introduces the background of BootstrapData binding, special column processing and column sorting functions. The code is simple and easy to understand, very good, and has reference value. It is needed Friends, please refer to it
This section mainly introduces Bootstrap’s background data binding, special column processing and column sorting functions
1. Data binding
Generally when doing programming, it is rare to use json files to directly bind data. Basically we use programming language to obtain data and do data binding.
Place a Table control
<table id="table" ></table>
Code to call javascript
<script > $('#table').bootstrapTable({ url: 'tablejson.jsp', //数据绑定,后台的数据从jsp代码 search:true, uniqueId:"Id", pageSize:"5", pageNumber:"1", sidePagination:"client", pagination:true, height:'400', columns: [ { field: 'Id', title: '中文' }, { field: 'Name', title: 'Name' } , { field: 'Desc', title: 'Desc' } ], });
2. Special column Processing
In practical applications, we need to add our special columns, such as operation columns. See the following js code to add a special column
{ field: '#', title: 'control',formatter:function(value,row,index){ var del='<a href="Delete!delete.action?Id='+row.Id+'" rel="external nofollow" rel="external nofollow" >删除</a>'; var updt='<a href="supdate.jsp?Id='+row.Id+'" rel="external nofollow" rel="external nofollow" >修改</a>'; var add='<a href="Include.jsp?Id='+row.Id+'" rel="external nofollow" rel="external nofollow" >增加</a>' return del+" "+updt+" "+add; } }
js The code is modified to
Latest Articles by Author
2023-03-15 16:54:01 2023-03-15 12:26:02 2023-03-14 18:58:01 2023-03-14 11:30:01 1970-01-01 08:00:00 2023-03-16 15:20:01 1970-01-01 08:00:00 1970-01-01 08:00:00 1970-01-01 08:00:00 1970-01-01 08:00:00Latest Issues