数据网格(datagrid)的 rowStyler 函数的设计目的是允许您自定义行样式。
查询用户并设置不允许收费的用户背景色突出显示
function onReady(){ $('#basicInfoList').datagrid("options").url=rootpath+"/queryPageListBySql?sqlKey=com.online.charge.customer.jccustomer.mapper.JcCustomerExtendsMapper.selectAllList"; var conditions = []; gridLoad(conditions,null); showColor(); } //不允许收费显示背景色 function showColor(){ $('#basicInfoList').datagrid({ rowStyler:function(index,row){ if (row.isAllowCharge == "0" || row.isAllowCharge == 0){ return 'background-color:#668B8B;'; } } }); }
效果如下