Reportico
Reportico

Hi there

Apologies if im not spotting an obvious answer here but i fairly new to october cms.

I have several columns in my list view and all are searchable. Say one of the columns is user, I would like a filter option to allow entry of a value or a match string to search on just that column. Ideally i would have a search box on only one column.

Im not interested in using the "group" filter option to be able to provide a selection list box containing values matching the string, I just want to be able to type the text and search everything where that column matches or is equal to.

Is there a way to do this..

Now additionally and Ideally this would cause the list view to refresh on each key stroke, but due the sheer number of records I would only want to refresh once the user has type more than say 2 characters so we dont return too much..

I tried to do this using a group type in a custom options method in the filter definitions config_filter.yaml as below but im having to use a group, what im after is a

user:
    label: User
    type: group
    conditions: user like (:filtered)
    modelClass: vendor\plugin\Models\Users
    options: matchingUsers

Then in the model i have a method that counts the search string and only returns a string but this is clearly not working because im trying to mis use the group type ...

function matchingUsers()
{   
    $search = post("search");
    if ( strlen($search) < 2 )
        $arr = ["Need more input"];
    else
        $arr = ["%{$search}%"];
    }
    return $arr;
}

Thanks in advance Peter

david19236
david19236

Ivic has a good video on this topic, if you select speed x2 you can cover the topic in 6mins

http://watch-learn.com/video-tutorials/making-websites-october-cms-part-35-backend-filters

1-2 of 2