DHTMLX Docs & Samples Explorer

Index
dhtmlxconnector

## beforeSort

This event occurs before data loading and allows to customize sorting of dataset

            $gridConn->event->attach("beforeSort",handlerFunc);

handlerFunc gets the following arguments:

- $sort_by - SortInterface object

Sample of usage:

       function custom_sort($sorted_by){
              // SORT BY LENGTH(some_field)
              $sorted_by->rules[0]["name"]="LENGTH(some_field)";
       }
       $conn->attach->event("beforeSort","custom_sort");