AshishJoshi-asj / zfdatagrid

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

Input boxes displayed for inactive filters #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add one, or two, filters to Grid
  $filters = new Bvb_Grid_Filters();
  $filters->addFilter('notes')          ;
  $grid->addFilters($filters);

2.
3.

What is the expected output? What do you see instead?
I expect to see only active Filter input box.

Input boxes are displayed for all filters/fields, not just for "notes". 
Those other filters do not trigger any action. They are not filtering at all.

I tried 
-  $grid->setNoFilters(1);, but that did not clear default filters. This
command disables all filters, default ones and the ones added manually.
-  $grid->setDefaultFilters(array ()); but that did not clear default filters.

What version of the product are you using? On what operating system?
0.6alpha

Please provide any additional information below.
This way it is not possible for the user to know which Filter is active.
Inactive filters should be hidden, or somehow marked as inactive.

Original issue reported on code.google.com by vlatko.b...@gmail.com on 11 Feb 2010 at 12:11

GoogleCodeExporter commented 9 years ago
Hi,

Bvb_Grid_Filters is only a helper for custom filters.

If you would like to disable the search in a particular field use this:

$grid->updateColumn('Field',array('search'=>false));

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 11 Feb 2010 at 12:28

GoogleCodeExporter commented 9 years ago
Yes, it does work.

How come that $grid->setDefaultFilters(array ()) does not disable all filters?

Original comment by vlatko.b...@gmail.com on 11 Feb 2010 at 12:35

GoogleCodeExporter commented 9 years ago
Hi,

setDefaultFilters() is intended to set the default values for filters

$grid->setDefaultFilters(array('Name'=>'Portugal'));

On load, the grid will be filtered by Name containing Portugal.

Maybe the name should be setDefaultFiltersValues()

But I will change the Bvb_Grid_Filters behavior.

If used, all others fields not specified will be turn off.

Best Regards,
Bento Vilas Boas 

Original comment by pao.fre...@gmail.com on 11 Feb 2010 at 3:05

GoogleCodeExporter commented 9 years ago
I vote for name change. :-)

Original comment by vlatko.b...@gmail.com on 11 Feb 2010 at 3:14

GoogleCodeExporter commented 9 years ago
Done.

Name changed from setDefaultFilters to setDefaultFiltersValues and behavior 
when add
filters from Bvb_Grid_Filters also changed. It not specified, the field input 
won't
be displayed.

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 11 Feb 2010 at 3:18

GoogleCodeExporter commented 9 years ago
It works now, but I encountered another issue:

Mysqli prepare error: Column 'xname' in where clause is ambiguous

I created a complete file with all the info. As I figured out, the problem exist
because two tables have the same name (which are correctly referenced in field 
list
part), but Filter does not follow that.
Below is part of Exception (rest in file):

SELECT `xaddressbook`.`id`, `xaddressbook`.`xname`, `xusers`.`id` AS `userID` 
FROM `xaddressbook`\n LEFT JOIN `xusers` ON xusers.id = xaddressbook.userID 
WHERE (xname LIKE '%Ana%') -- xname is not referenced with table name
LIMIT 15

Original comment by vlatko.b...@gmail.com on 11 Feb 2010 at 4:40

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed

Original comment by pao.fre...@gmail.com on 11 Feb 2010 at 6:36

GoogleCodeExporter commented 9 years ago

Original comment by pao.fre...@gmail.com on 11 Feb 2010 at 6:36

GoogleCodeExporter commented 9 years ago

Original comment by pao.fre...@gmail.com on 11 Feb 2010 at 6:36

GoogleCodeExporter commented 9 years ago
Hi Pao,

It works, but I encountered the same a problem that might be useful in manual.

I added filter like this
 ->addFilter('name', array(
  'distinct' => array(
  'field' => 'name', 'name' => 'name',)))

and it didn't work, but when I added table name 'addressbook to field all works
->addFilter('name', array(
  'distinct' => array(
  'field' => 'addressbook.name', 'name' => 'name',)))

I do not think it is possible to automate this table name addition because one 
might
want to filter for another field by the same name (e.g. 'countries.name').

Original comment by vlatko.b...@gmail.com on 11 Feb 2010 at 7:11

GoogleCodeExporter commented 9 years ago
Hi,

No need to prefix the table name. I know the field table based on the field 
output.

Please updated tot the latest SVN revision (561+) and check if it work.

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 11 Feb 2010 at 11:16

GoogleCodeExporter commented 9 years ago
Hi Pao,

No, it is still the same error. If I use 
->addFilter('name')   >> initial Grid is OK, but error below occures
->addFilter('addressbook.name')   >> Filter is not displayed in Grid at all

Here is the Where part of select. I got in Data.php on line 2182:

where   Array [1]   
    0   (string:21) (name LIKE '%Draki%')   

And full select:

SELECT `addressbook`.`id`, `addressbook`.`hDateTime`, `addressbook`.`name`,
       `users`.`name` AS `userID`, `countries_1`.`name` AS `countryID` 
  FROM `addressbook`
   LEFT JOIN `users` ON users.id = addressbook.userID
   LEFT JOIN `countries` AS `countries_1` ON countries_1.id = addressbook.countryID
 WHERE (name LIKE '%Ana%') 
LIMIT 10

Original comment by vlatko.b...@gmail.com on 12 Feb 2010 at 10:30

GoogleCodeExporter commented 9 years ago
HI,

Please try again.

Revision 564+.

Best Regards,
Bento Vilas Boas

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

GoogleCodeExporter commented 9 years ago
Hi Pao,

Still the same. 

SELECT `addressbook`.`id`, `addressbook`.`hDateTime`, `addressbook`.`name`, 
   `users`.`name` AS `userID`, `countries_1`.`name` AS `countryID` 
FROM `addressbook`
 LEFT JOIN `users` ON users.id = addressbook.userID
 LEFT JOIN `countries` AS `countries_1` ON countries_1.id = addressbook.countryID
WHERE (name LIKE '%Ana%') ******

Original comment by vlatko.b...@gmail.com on 12 Feb 2010 at 12:20

GoogleCodeExporter commented 9 years ago
I think it should be fine now.

please try again.

Revision 565

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 12 Feb 2010 at 12:50

GoogleCodeExporter commented 9 years ago
Hi Pao,

It works. All field name problems are gone. :-))

Original comment by vlatko.b...@gmail.com on 12 Feb 2010 at 2:14

GoogleCodeExporter commented 9 years ago

Original comment by pao.fre...@gmail.com on 12 Feb 2010 at 2:17

GoogleCodeExporter commented 9 years ago

Original comment by pao.fre...@gmail.com on 12 Feb 2010 at 2:17

GoogleCodeExporter commented 9 years ago

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