* Please note this feature is not available in Lite and Basic versions.
Conditional Value is similar to conditional format (see set_conditional_format) but with simpler set of features. Use set_conditional_value() to dynamically display a value when specific condition is met. The conditional value can be text, HTML, or even CSS style.
You can use conditional value with data bar in the same grid.
1 2 3 4 5 6 7 8 | .tstyle { display:block;background-image:none;margin-right:-2px;margin-left:-2px;height:14px;padding:5px;background-color:green;color:navy;font-weight:bold } .fstyle { display:block;background-image:none;margin-right:-2px;margin-left:-2px;height:14px;padding:5px;background-color:yellow;color:navy } |
PHP Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | $dg = new C_DataGrid("SELECT * FROM joborders", "jobNumber", "joborders"); $dg -> set_col_title("jobNumber", "Job Number"); $dg -> set_col_title("jobDescription", "Description"); $dg -> set_col_title("status", "Status"); $dg -> set_col_title("percentComplete", "Progress (%)"); $dg -> set_col_title("isClosed", "Closed"); $dg->set_conditional_value("isClosed", "==1", array( "TCellValue"=>"<img src='SampleImages/checked.gif' />", "FCellValue"=>"<img src='SampleImages/unchecked.gif' />")); $dg->set_conditional_value("status", "=='Complete'", array( "TCellStyle"=>"tstyle", "FCellStyle"=>"fstyle")); $dg->enable_edit('INLINE', 'CRUD'); $dg->set_multiselect(true); $dg -> set_databar("percentComplete","red"); $dg -> display(); |
Note:
For even more complex conditions, please refer to row level permission example by using set_grid_property() and add_event() method.