Hi,
Sorry - was damn busy with project work.. hardly get time for myself. .. anyways - i am sharing u a solution for the same... You know what happens up in GC for relations.. when we try to search - it still fails to search through the text values being shooted.
Here - i am sharing a solution that i worked out for the same solution... say i have a field partner_assigned_to (that is an id representing to an employee)
Now when displaying the partner_Assigned_to - i display emp_first_name and emp_last_name merged. Now i have to search the text from user in both this fields ...so here is what i do...
(Sorry - i worked out this solution on bootstrap theme where user can search for an individual search box for each field. Let's first go through the code solution below - then we will go ahead with other solution)
/* Controller Code */
if(isset($_POST['search_field'])) {
$searchFields = $_POST['search_field'];
$searchValues = $_POST['search_text'];
$key = array_search('partner_assigned_to', $searchFields);
if($key !== false) {
$searchFields[$key] = 'emp_first_name';
$_POST['search_field'] = $searchFields;
}
}
//In case the we encountered the search field to be partner_assigned_to ..... what we do is - add emp_first_name
//to the searchFields instead of partner_assigned_to -- now it will work for same - because that field is available
//as the reason for relationship
//Now here is the trick if u have a multiple fields merged up just in case like i have had for my project.
//If we encounter - the search field to have emp_first_name ... we also include and OR_like for emp_last_name...
if(isset($_POST['search_field'])) {
$searchFields = $_POST['search_field'];
$searchValues = $_POST['search_text'];
$key = array_search('emp_first_name', $searchFields);
if($key !== false) {
$crud->or_like('trade_partners.emp_last_name', $searchValues[$key]);
}
}
This way we encounter the solution for relation ship in the bootstrap theme.
Now in case of flexigrid, there may not be a case of search_fields being set up ... in such scenario - we can just add up
$crud->or_like($someTextFieldNameForRelation) ... this will ensure that the text is not only search in the values in the current table .. but also related tables.
Happy GCing to you all :)