Code Monkey home page Code Monkey logo

yii-datafilter's Introduction

Yii Data Filter

Alfa code! This extension is brandnew and very much in development. Do not expect stable code yet!

It happens often enough that you need to be able to filter data from models. If you are anything like me, you are probably sick of (re)writing the same code all the time. Hence this extension. The goal is to develop a generic filter "framework" that can easily be added to any model you want.

Todo

  • Filter Validation
  • Dynamic adding of filters to form (based on the Dynamic filter)

Usage

I am currently limiting the information in this section as it's expected to change quite a bit in the future. There are 3 "entry points" for this extension:

IFilterable

An interface that every model that wants to use the data filter capabilities needs to implement. It contains 2 functions:

  • dataFilterGetOptions: Called to obtain filter-related configuration. It should return an array. The actual content depends on the filter used.
  • dataFilterApply: Called to apply rules to the given DbCriteria instance. It receives the relevant filter as well.

DataFilterer

This object contains the actual filters and can serialize itself. Note: I had the actual filters also serialize themselves as I want to be able to dynamically add new ones. Keep this in mind when creating the filterer. The 2nd instantiation it probably already contains the filters from the previous run.

DataFiltererWidget

The actual widget that receives the filterer. It can be used in views to output everything.

yii-datafilter's People

Contributors

blizzke avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.