Set Custom Color Indicator in List View - Merci Web Designer
Overview
In MerciGlobal Cloud ERP, developers and administrators can improve the user interface of list views by setting custom color indicators using PHP logic. This guide demonstrates how to dynamically color the first column of a list view based on database-driven conditions.
Module/Table Setup
To configure this feature:
- Open Merci Web Designer
- Select the appropriate Module/Table for customization
- Navigate to Table Script
-
Set:
-
Script Type:
List - Color (Web)
Insert the following PHP script:
$cQ = "SELECT id FROM #trn_salesreturn WHERE billno={$row['bserial']} AND compid={$row['compid']}";
$resz = myExecute($cQ);
if ($resz->num_rows > 0) {
$firstcoldata .= "CLR:#ff99cc;";
}
$resz->close();
How It Works
- The
$row
array contains each recordβs data during list view rendering. $firstcoldata
is used to dynamically assign a background color to the first column.-
The script checks for matching entries in the
#trn_salesreturn
table where: -
billno = {$row['bserial']}
compid = {$row['compid']}
- If a match is found, the background color is set to pink (
#ff99cc
).
β‘ Performance Tips
β οΈ Ensure the
billno
andcompid
fields in#trn_salesreturn
are indexed for optimal query performance. This is crucial since the query runs for each row in the list view.
Use Cases
- Highlight invoices that have related Sales Return records
- Visually indicate payment statuses or flagged records
- Enhance user experience with instant visual cues
Notes
- This script executes for each row during list view rendering
- Color highlights only apply when conditions are met
- Always construct
$firstcoldata
carefully to avoid UI disruptions
Example Scenario
Imagine you're viewing the Sales Register. To easily spot which invoices have an associated Sales Return, use this color-coded method. It provides immediate visual differentiation, aiding in quicker data analysis.
For more tips and UI enhancements in MerciGlobal Cloud ERP, continue exploring our official documentation!