Ip\Internal\Grid\Model\Table::search PHP Method

    protected function search($data)
    {
        $statusVariables = $this->statusVariables;
        $display = $this->getDisplay();
        $searchForm = $display->searchForm(array());
        $errors = $searchForm->validate($data);
        if ($errors) {
            $data = array('error' => 1, 'errors' => $errors);
        } else {
            $newData = $searchForm->filterValues($data);
            foreach ($newData as $key => $value) {
                if (in_array($key, array('antispam', 'securityToken'))) {
                    continue;
                }
                if ($value == '') {
                    unset($statusVariables['s_' . $key]);
                    unset($statusVariables['s_' . $key . '_json']);
                    continue;
                }
                if (is_array($value)) {
                    foreach ($value as $subkey => $subval) {
                        $statusVariables['s_' . $key . '_json'] = json_encode($value);
                        unset($statusVariables['s_' . $key]);
                    }
                } else {
                    $statusVariables['s_' . $key] = $value;
                }
            }
            foreach ($searchForm->getFields() as $field) {
                if (!isset($newData[$field->getName()])) {
                    //script above fails to remove search made based on checkbox as empty checkbox doesn't post anything
                    unset($statusVariables['s_' . $field->getName()]);
                    unset($statusVariables['s_' . $field->getName() . '_json']);
                }
            }
            $commands[] = Commands::setHash(Status::build($statusVariables));
            $data = array('error' => 0, 'commands' => $commands);
        }
        return $data;
    }