Bootstrap Table (2), bootstraptable

Source: Internet
Author: User

Bootstrap Table (2), bootstraptable

Related reading:

Bootstrap Table use organization (1) http://www.bkjia.com/article/115789.htm

Bootstrap Table use organization (3) http://www.bkjia.com/article/115795.htm

Bootstrap Table use organization (4) toolbar http://www.bkjia.com/article/115798.htm

Bootstrap Table query http://www.bkjia.com/article/115785.htm using a composite paging (5)

1. Modify the row style

<Table id = "table1" data-row-style = "rowStyle"> </table>/** data-row-style extension method for processing row styles */$ ('# table1 '). bootstrapTable ({columns: [{field: 'sno', title: 'student number'}, {field: 'sname', title: 'student name'}, {field: 'ssex, title: 'gender'}, {field: 'sbirthday', title: 'birthday'}, {field: 'class', title: 'Course number'},], url: '@ Url. action ("GetStudent", "DataOne") '});/***** @ param row current row data object * @ param index current row index * /Function rowStyle (row, index) {var classes = ['active', 'success', 'info', 'warning', 'danger ']; if (row. sno. indexOf ('2 ')! =-1) {return {classes: ['success']} return {};}

Ii. Cell style definition and alignment Definition

/** Data-cell-style Extension Method Processing cell style * data-align sets the alignment of the current column, including setting the table title alignment in the header * data-halign, the priority is higher than align */$ ('# table1 '). bootstrapTable ({columns: [{field: 'sno', title: 'student number', align: 'center', halign: 'right', cellStyle: function (value, row, index) {// The current column. if (index % 2 = 0) return {classes: 'success '}; return {}}, {field: 'sname', title: 'student name'}, {field: 'ssex, title: 'gender '}, {field: 'sbirthday', title: 'birthday '}, {field: 'class', title: 'Course number'},], url: '@ Url. action ("GetStudent", "DataOne ")'});

Iii. Sorting column Definition

/** Data-sortable: sets whether the current column can be sorted, by default, the currently displayed content is sorted * data-sort-name, and the default sorting column name * data-sort- order sets the default sorting method. asc/desc * data-sorter can customize the extended sorting method */ $ ('# table1 '). bootstrapTable ({columns: [{field: 'sno', title: 'student number ', sortable: true}, {field: 'sname', title: 'student name ', sortable: true}, {field: 'ssex, title: Gender, sortable: true}, {field: 'sbirthday', title: 'birthday', sortable: true}, {field: 'class', title: 'Course number', sortable: true},], url: '@ Url. action ("GetStudent", "DataOne ")'}); <table id = "table1" data-classes = "table-hover table-condensed" data-sort-name = "sno" data-sort-order = "desc"> </table>

The above section describes how to use Bootstrap Table (2). I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.