JQuery MiniUI development tutorial table control table: Custom columns (2)

Source: Internet
Author: User

Reference example: data table paging table



A table column configuration set (columns) is an array, such as [column, column,...].
The configuration parameters of one column are as follows:


 

The Code is as follows:

<Div id = "datagrid1" class = "mini-datagrid" style = "width: 700px; height: 280px ;"
Url = "../data/DataService. aspx? Method = SearchEmployees"
>
<Div property = "columns">
<Div type = "indexcolumn"> </div>
<Div field = "loginname" width = "120" headerAlign = "center" allowSort = "true"> employee account </div>
<Div field = "name" width = "120" headerAlign = "center" allowSort = "true"> name </div>
<Div field = "gender" width = "100" renderer = "onGenderRenderer" align = "center" headerAlign = "center"> gender </div>
<Div field = "salary" width = "100" allowSort = "true"> salary </div>
<Div field = "age" width = "100" allowSort = "true"> age </div>
<Div field = "createtime" width = "100" headerAlign = "center" dateFormat = "yyyy-MM-dd" allowSort = "true"> creation date </div>
</Div>
</Div>

We can also use Javascript as follows:

Var grid = new mini. DataGrid ();
Grid. set ({
Url: "../data/DataService. aspx? Method = SearchEmployees ",
Style: "width: 700px; height: 280px ;",
Columns :[
{Type: "indexcolumn "},
{Header: "Employee account", field: "loginname", width: 120, headerAlign: "center", allowSort: true },
{Header: "name", field: "name", width: 120, headerAlign: "center", allowSort: true },
{Header: "gender", field: "gender", width: 100, align: "center", renderer: onGenderRenderer },
{Header: "salary", field: "salary", width: 100, allowSort: true },
{Header: "age", field: "age", width: 100, allowSort: true },
{Header: "creation date", field: "createtime", width: 100, headerAlign: "center", allowSort: true, dateFormat: "yyyy-MM-dd "}
]
});
Grid. render (document. body );
 
Note: You can use Javascript or HTML to create a table.

 

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.