Update Datagrid/Datagrid.php

Fix sorting by entity issue. See #1035