Using a search trigger field and a relation URL hash
Finally, let's implement the SearchField
in the top-right corner of the screen. Actually, it is already implemented on the client side.
When we are calling getGrid
with the cond
argument, the search criteria is being transmitted. That is to say, we just need to implement on the server side. Let's amend this quickly.
This just shows a section that has been amended. To see the whole section of the source code, please refer to the source files (source file: 07_using_search_trigger_field_and_relation_url_hash/php/classes/MyAppQuotation.php
).
.... 'ON', ' customers.id = quotation.customer', 'WHERE', ' quotation.status = 1' )); $query = explode(' ', @$cond->query); foreach($query as $q) { if($q != '') { $sql .= ' ' . implode(" \n ", array( 'AND (', ' customers.name like \'%' . $q . '%\'...