⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

filter doesn't work on callback_column



davedriesmans

davedriesmans
  • profile picture
  • Member

Posted 13 September 2013 - 12:31 PM

hi,

 

it seems filtering/searching on a callback_column doesn't work. is it true and is there a workaround?

GENUS or Genus (Phylum) in the header is the callback column in this example.

 

best,

dave

 

in attach my code and an screenshot

 

function funbas()
{

        try{
            $crud = new grocery_CRUD();

            $crud->set_table('funbas');

            // call back for Genus - soortnaam
            $crud->callback_edit_field('GENUS',array($this,'dropdowngenusGroupMYC'));
            $crud->callback_add_field('GENUS',array($this,'dropdowngenusGroupMYC'));

            //  $crud->set_relation('GENUS', 'funbasGenus','genus');
            $crud->set_relation('categorie', 'funbasCategorie','categorie');
            $crud->set_relation('Eco1', 'funbasCdeEco','Functionele_groep');
            $crud->set_relation('Eco2', 'funbasCdeEco','Functionele_groep');
            $crud->set_relation('RLNL', 'funbasCdeRLNL', 'catNL');
            $crud->set_relation('RLVL', 'funbasCdeRLVL', 'catVL');
            $crud->set_relation('bibref', 'funbasBib', '{AUTEUR} - ({JAAR}) {bib_titel}');
            $crud->set_relation('status', 'funbasStatus', 'status');

            $crud->set_subject('funbas');
            $crud->columns('FUNBAS_ID', 'GENUS', 'SOORTNAAM', 'SPECIES', 'NEDNAAM', 'SYNONIEM', 'bibref', 'status', 'exportNR');
            $crud->display_as('GENUS','Genus (phylum)');
            $crud->order_by('GENUS asc, SOORTNAAM');


            $crud->callback_column('GENUS', array($this, 'genusGroupMYC'));
            $crud->callback_column('status', array($this, 'callbackStatus'));

            $output = $crud->render();
            $this->view_output_funbas($output, $data);


        }catch(Exception $e){
            show_error($e->getMessage().' --- '.$e->getTraceAsString());
        }
}




    /* funbas functions  */

    function genusGroupMYC($value)
    {
        $row=$this->Funbas_model->GetGenusGroupMYC($value);
        if (isset($row['genus_name'])) {
            $genusGroupMYC = $row['genus_name']. ' ('.$row['phylum'].')';
        } else {
            $genusGroupMYC = '-';
        }
        return $genusGroupMYC;
    }


    function dropdowngenusGroupMYC($value)
    {
        $funbasArray=$this->Funbas_model->GetGenusGroupMYC();

        $input = "<select name='GENUS' id='' class='chosen-select' data-placeholder='Select ...'>";
        $input .= '<option value=""></option>';
        foreach ($funbasArray as $row) {
            $selected = '';
            if ($row['ID'] == $value) {
                $selected = 'selected';
            }
            $input .= '<option value="'.$row['ID'].'" '.$selected.'>'.$row['genus_name'].' ('.$row['phylum'].')</option>';
        }
        $input .= '</select>';
        return $input;
    }

grocerycrud-callback.png

 


davidoster

davidoster
  • profile picture
  • Member

Posted 13 September 2013 - 19:32 PM

This is duplicate, please follow here.