By default, BigTree will show every row in a table in any given view. You can choose which rows to display by setting a filter on your view. You can set the Filter Function on a view via the settings button next to your view type when editing your view.

When entering your Filter Function enter only the name of the function or the static reference to a class method (i.e. myFilterFunction or MyClass::filterFunction). Your filter function should accept a single array as its only parameter and return either true if you want the row in your view or false if you don't want it in your view. The array parameter is the row from the database with pending changes applied. There is also a bigtree_pending_changes column in the array which is a JSON encoded list of changes. If you wish to get the unaltered (without pending changes) version of the row you can query it manually in your filter function. Because all the rows are cached you don't need to worry about database overhead in your filter function.

Pending Rows

Rows in the table that exist only in bigtree_pending_changes are also included in your view and will be passed into your filter function. These rows will have additional columns:

  • bigtree_pending — Always set to true
  • bigtree_pending_owner — Set to the ID of the user that created this pending row
  • id — This is set to the ID of the row in bigtree_pending_changes prefixed with a "p" (i.e. "p15" for the row in bigtree_pending_changes with id 15).

Example Filter Function

The example below will only include items where the rating column is above 5.

function myFilterFunction($item) {
    if ($item["rating"] > 5) {
        return true;
    }
return false; }