src/Table.php
public function setFilterColumn($cols = null)
    {
        if (!$this->model) {
            throw new Exception('Model need to be defined in order to use column filtering.');
        }

        // set filter to all column when null.
        if (!$cols) {
            foreach ($this->model->elements as $key => $field) {
                if (isset($this->columns[$key]) && $this->columns[$key]) {
                    $cols[] = $field->short_name;
                }
            }
        }

        // create column popup.
        foreach ($cols as $colName) {
            $col = $this->columns[$colName];
            if ($col) {
                $pop = $col->addPopup(new FilterPopup(['field' => $this->model->getElement($colName), 'reload' => $this->reload, 'colTrigger' => '#'.$col->name.'_ac']));
                $pop->isFilterOn() ? $col->setHeaderPopupIcon('green caret square down') : null;
                $pop->form->onSubmit(function ($f) use ($pop) {
                    return new jsReload($this->reload);
                });
                //apply condition according to popup form.
                $this->model = $pop->setFilterCondition($this->model);
            }
        }
    }
public function setFilterColumn($cols = null)
    {
        if (!$this->model) {
            throw new Exception('Model need to be defined in order to use column filtering.');
        }

        // set filter to all column when null.
        if (!$cols) {
            foreach ($this->model->elements as $key => $field) {
                if (isset($this->columns[$key]) && $this->columns[$key]) {
                    $cols[] = $field->short_name;
                }
            }
        }

        // create column popup.
        foreach ($cols as $colName) {
            $col = $this->columns[$colName];
            if ($col) {
                $pop = $col->addPopup(new FilterPopup(['field' => $this->model->getElement($colName), 'reload' => $this->reload, 'colTrigger' => '#'.$col->name.'_ac']));
                $pop->isFilterOn() ? $col->setHeaderPopupIcon('green caret square down') : null;
                $pop->form->onSubmit(function ($f) use ($pop) {
                    return new jsReload($this->reload);
                });
                //apply condition according to popup form.
                $this->model = $pop->setFilterCondition($this->model);
            }
        }
    }
public function setFilterColumn ( $ cols = null ) { if ( ! $ this -> model ) { throw new Exception ( 'Model need to be defined in order to use column filtering.' ) ; } // set filter to all column when null. if ( ! $ cols ) { foreach ( $ this -> model -> elements as $ key => $ field ) { if ( isset ( $ this -> columns [ $ key ] ) && $ this -> columns [ $ key ] ) { $ cols [ ] = $ field -> short_name ; } } } // create column popup. foreach ( $ cols as $ colName ) { $ col = $ this -> columns [ $ colName ] ; if ( $ col ) { $ pop = $ col -> addPopup ( new FilterPopup ( [ 'field' => $ this -> model -> getElement ( $ colName ) , 'reload' => $ this -> reload , 'colTrigger' => '#' . $ col -> name . '_ac' ] ) ) ; $ pop -> isFilterOn ( ) ? $ col -> setHeaderPopupIcon ( 'green caret square down' ) : null ; $ pop -> form -> onSubmit ( function ( $ f ) use ( $ pop ) { return new jsReload ( $ this -> reload ) ; } ) ; //apply condition according to popup form. $ this -> model = $ pop -> setFilterCondition ( $ this -> model ) ; } } }
Set Popup action for columns filtering.

@param array $cols An array with colomns name that need filtering.

@throws Exception
@throws \atk4\core\Exception
Set Popup action for columns filtering .