HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
This tutorial will show you how to change the Line Style Data Grid (datagrid) assembly according to a number of conditions. When listprice value is greater than 50, we will set a different color for the row.
Designed for data grid (datagrid) of rowStyler function is to allow you to customize the line styles. The following code shows how to change the line style:
<Table id = "tt" title = "DataGrid" style = "width: 600px; height: 250px" url = "data / datagrid_data.json" singleSelect = "true" fitColumns = "true"> <Thead> <Tr> <Th field = "itemid" width = "80"> Item ID </ th> <Th field = "productid" width = "80"> Product ID </ th> <Th field = "listprice" width = "80" align = "right"> List Price </ th> <Th field = "unitcost" width = "80" align = "right"> Unit Cost </ th> <Th field = "attr1" width = "150"> Attribute </ th> <Th field = "status" width = "60" align = "center"> Stauts </ th> </ Tr> </ Thead> </ Table>
$ ( '# Tt'). Datagrid ({ rowStyler: function (index, row) { if (row.listprice> 50) { return 'background-color: pink; color: blue; font-weight: bold;'; } } });
As you can see, we set the background-color (background color), according to some conditions for the pink (pink), set the text color to blue (blue).