Changes
Title
unchanged
Search a file size range in CGridView
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
search, file size, range, size range filter, CGridView
Content
changed
### Introduction
Working on a report system of files transfert, I had to let the users simply find files by size. I didn't want to have two fields, I prefer a simple text input, with "human syntax".
### Overview
To be able to add file size range searching functionality to your advanced search forms (not grid view filters) without having to add public attributes, 'safe' rules, and chunky search conditions for each
datfile size attribute.
1. Create an Active Record Behavior that builds the criteria for the search() method and attach it to your model
2. Modify the search() method of the model to merge the behavior's criteria in with the rest of the searchable attributes
### Assumptions[...]