Jqueryeasyui Study Notes (12) DataGrid prompt, format table, table button (source code)

Source: Internet
Author: User
You are welcome to repost it. Please indicate the source for reprinting! I hope this note will be useful to myself and everyone, but I have a limited level. If something goes wrong, I hope you can point out more criticism. Thank you! Today is the prompt, format table, and table button of the DataGrid frame:

The DataGrid is still used today, because there are too many attribute methods and it cannot be completed. Let's take a look at the examples and demos on the official website: examples on the official website

Column StyleCode:

 
Styler:Function(Value, rowdata, index ){//Set the column style (column attribute API), value column value, index column index, and rowdata row dataIf(Index <3){Return'Background-color: # ffee00; color: red ;';}}

 

Line style code:

Rowstyler:Function(Index, row ){//Same as Column Style usageIf(Row. Code = 001){Return'Background-color: # 6293bb; color: # FFF ;';}}

 

Formatter method usage:

Formatter: Function (Value, rowdata, index ){ //  Value: the value of a field. Rowdata: Row data. Rowindex: Row index.                          Return "<Span Title = '" + value + "'>" + value + "<span> "; // Prompt when you move your mouse over a cell                          //  Return "*****"; // display the asterisks  } Formatter:  Function (Value, rowdata, index ){ //  Value: the value of a field. Rowdata: Row data. Rowindex: Row index.                          Return "<Button onclick = 'clickfunc (" + index + "); '> operation </button> "; //  Pass the index to the method. You can select this row.  }  //  Operation clicking Method     Function  Clickfunc (INDEX ){  VaR Rows = $ ("# DG"). DataGrid ("getrows" ); Alert (rows [Index]. ADDR );  //  Obtain the data of the click row. }

 

Example:

Source code: Download source code

 

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.