合肥网站空间,网站城市跳转怎么做,安平丝网网站建设,网站推广去哪家比较好author YHC 以下示例格式化在easyui DataGrid 里的列数据,和使用自定义列formatter ,如果价格小于20就将文本变为红色. 查看 Demo 格式化一个DataGrid 列,我们需要设置formatter 属性它是一个函数,这个格式化函数包含三个参数: value: 当前列对应字段值.row: 当前的row(行)记录…author YHC 以下示例格式化在easyui DataGrid 里的列数据,和使用自定义列formatter ,如果价格小于20就将文本变为红色. 查看 Demo 格式化一个DataGrid 列,我们需要设置formatter 属性它是一个函数,这个格式化函数包含三个参数: value: 当前列对应字段值.row: 当前的row(行)记录数据.index: 当前的行下标. 创建 DataGrid table idtt titleFormatting Columns classeasyui-datagrid stylewidth:550px;height:250px urldata/datagrid_data.json singleSelecttrue iconClsicon-save thead tr th fielditemid width80Item ID/th th fieldproductid width80Product ID/th th fieldlistprice width80 alignright formatterformatPriceList Price/th th fieldunitcost width80 alignrightUnit Cost/th th fieldattr1 width100Attribute/th th fieldstatus width60 aligncenterStauts/th /tr /thead
/table 注意 listprice字段有一个 formatter属性这个指明格式化函数. 写格式化函数 function formatPrice(val,row){ if (val 20){ return span stylecolor:red;(val)/span; } else { return val; }
} 下载 EasyUI示例代码: easyui-datagrid-demo.zip