AshishJoshi-asj / zfdatagrid

Automatically exported from code.google.com/p/zfdatagrid
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

New supported search operators (behaviours) ideas #186

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
What is the expected output? What do you see instead?

Currently, when a filter element, as a HTML SELECT, was declared for a
column "A", the search operator is applied for each filter entry. (practice
: ALL ITEMS (= 1 filter element) SHARE ONE OPERATOR)

But it is a common practice to want to have multiple search operators in a
same filter component :
- basically we can need to have an item which display all lines whose
column "A" value < X and another item displaying all column "A" values > X,
so two operators for a filter (practice : ONE OPERATOR PER ITEM)
- by extending, we can imagine also (it is one of my case) a filter which
items could be = X, or IN (Y,Z) or > 0 (practice : ONE OPERATOR PER ITEM)
- by still extending, we can imagine a filter whose each item could be a
series of operator (one item displays line whose column value is = X AND IN
(Y,Z) OR > 0 (practice : SEVERAL OPERATORS PER ITEM)

That could be very high-performance !

NB : As perhaps noticed, a simple new operator idea : "IN" (for SQL).

What version of the product are you using? On what operating system?
v6.alpĥa, under Linux Fedora.

Please provide any additional information below.

Original issue reported on code.google.com by tribal...@gmail.com on 23 Feb 2010 at 3:17

GoogleCodeExporter commented 9 years ago
Hi,

You can now define the search operator that will be applied for each column.

$grid->updateColumn('field',array('searchType'=>'>'));
$grid->updateColumn('field2',array('searchType'=>'='));
$grid->updateColumn('field3',array('searchType'=>'REGEXP'));

You can also use shortcuts into filters fields to use you operators:

=1
>1
<>3

Check this examples:

http://zfdatagrid.com/grid/site/index/filtersois/%7B%22filter_Name%22:%22%22,%22
filter_Continent%22:%22%22,%22filter_Population%22:%22%3D22720000%22,%22filter_L
ocalName%22:%22%22,%22filter_GovernmentForm%22:%22%22%7D

http://zfdatagrid.com/grid/site/index/filtersois/%7B%22filter_Name%22:%22%22,%22
filter_Continent%22:%22%22,%22filter_Population%22:%22%3C22720000%22,%22filter_L
ocalName%22:%22%22,%22filter_GovernmentForm%22:%22%22%7D

http://zfdatagrid.com/grid/site/index/filtersois/%7B%22filter_Name%22:%22r%3A%28
s|n%29%24%22,%22filter_Continent%22:%22%22,%22filter_Population%22:%22%22,%22fil
ter_LocalName%22:%22%22,%22filter_GovernmentForm%22:%22%22%7D

Here is the list of supported operators.

(Replace {{value}} for user submitted  )
r:{{value}} // Will apply a regexp
12<>34//will do a between seacrh
=12// equal search
>=12// bigger or equal
>1//bigger
<12//less
<=12//Less or equal
!=21 //different
*12 // ends with 12
12* // starts with 12
*12* // contains 12

NEW:
12,13,14 // Values IN ()

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 23 Feb 2010 at 3:51

GoogleCodeExporter commented 9 years ago
Thanks.

I have read search operators in the Wiki and in fact it is convenient.

But I was talking about a filter as a HTML SELECT element, whose items could be
customized, for ONE column.

Example:

 Column A
[    ALL   ]
| = X      |
| IN (2,3) |
| > 0      |

Original comment by tribal...@gmail.com on 23 Feb 2010 at 3:57

GoogleCodeExporter commented 9 years ago
Hi,

Just apply the operator you want before:

Ex:

$filters = new Bvb_Grid_Filters();
$filters->addFilter('Population',array('values'=>array('<20000'=>'Less than
20.000','>=20000'=>'Greather than 20.000','=217000'=>'Equal to 217000')));
$grid->addFilters($filters);

Original comment by pao.fre...@gmail.com on 23 Feb 2010 at 4:04

GoogleCodeExporter commented 9 years ago
Ok, sorry :/
It is perfect !

Original comment by tribal...@gmail.com on 23 Feb 2010 at 4:10

GoogleCodeExporter commented 9 years ago

Original comment by bento.vi...@gmail.com on 3 Mar 2010 at 4:56