Developer Console v1.04 and Grey Hidden Records v1.01 Released!

By In-House-Logic - August 30, 2016

Great to see these developed further. The customization options are really appreciated!

This new greyHiddenRecords only works for CMSBuilder v.3+. For those of us still working with some v.2 sites, is there a way to limit the styling to a particular table? I've tried variations on the following with no luck:

// register callbacks
addFilter('listRow_trStyle',      'style_certain_records_listRow_trStyle', null, 3);

// **** KEY LINE FOLLOWS ****
function style_certain_records_listRow_trStyle($trStyle, $tableName = "cms_sc_orders", $record) {
    if (!@$record['hidden']) { // All non-hidden records are scanned for new rules.

        // Not locked, but no other checks - should highlight odd situations.
        if(!@$record['locked'] AND !@$record['paid'] AND @$record['order_id'])         
            { return "color: rgb(200,200,200);".$trStyle;  } 
            // pale grey, Order_ID added only to limit styling to Orders table.

    } // end rules for non-hidden fields

  return "color: #CCC;"; // default hidden style
}

and...

function style_certain_records_listRow_trStyle($trStyle, "cms_sc_orders", $record) {
    if (!@$record['hidden']) { // All non-hidden records are scanned for new rules.
// ... styling rules here...
}   
return "color: #CCC;"; // default hidden style
}

In both these cases we're trying to limit these styling rules to affect only the _sc_orders table.

Any ideas?

Jayme

By Daryl - August 30, 2016

Hi Jayme,

The 'listRow_trStyle' filter passes the table name of the section to $tableName variable.
You can use that to check if the current table is _sc_orders, if not, return the tr style without any changes.
For example:

function grey_hidden_records_listRow_trStyle($trStyle, $tableName, $record) {
  if ($tableName != '_sc_orders') { return $trStyle; } // change nothing if this is not the orders table
  if (!@$record['hidden']) { return $trStyle; } // skip if record either doesn't have a hidden field or the hidden field isn't checked
  return "color: #CCC;";
}

Cheers,

Daryl Maximo
PHP Programmer - interactivetools.com

By In-House-Logic - August 31, 2016

Perfect. Thanks Daryl!