silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
721 stars 821 forks source link

[2012-10-23] filter in existing files when using uploadfield in gridfield doesn't work #1624

Closed silverstripe-issues closed 11 years ago

silverstripe-issues commented 11 years ago

created by: @guyvanbael (guy.van.bael) created at: 2012-10-23 original ticket: http://open.silverstripe.org/ticket/7968


I'm using ss3.0.2 and created a pagetype with a dataobjet which contains a title and an image. When i use the uploadfield and wish to choose an image that has already been uploaded, i get the complete list from the files in the directory, but trying to filter that list always returns ALL the images in the directory. The filter doesn't have any effect.

silverstripe-issues commented 11 years ago

comment by: camfindlay created at: 2012-11-29


I can replicate this issue too... has just been brought up by a client.

Is there perhaps missing JS there that is present in the "Files" section of the CMS?

axyr commented 11 years ago

still an issue in ss 3.0.5

axyr commented 11 years ago

This fixes the issue for me:

in UploadField_SelectHandler::getListField()

after

$files = DataList::create($baseClass)->filter('ParentID', $folderID);

add

if(isset($_REQUEST['filter'])) { $filters = Convert::raw2sql($_REQUEST['filter']); foreach($filters as $name => $value) { $files->where("$name LIKE '%$value%'"); } }

guyvanbael commented 11 years ago

Hi Martijn,

In which file do you add this code?

thanx, guuy

On Mon, Apr 22, 2013 at 2:33 PM, Martijn notifications@github.com wrote:

This fixes the issue for me:

in UploadField_SelectHandler::getListField()

after

$files = DataList::create($baseClass)->filter('ParentID', $folderID);

add

if(isset($_REQUEST['filter'])) { $filters = Convert::raw2sql($_REQUEST['filter']); foreach($filters as $name => $value) { $files->where("$name LIKE '%$value%'"); } }

— Reply to this email directly or view it on GitHubhttps://github.com/silverstripe/sapphire/issues/1624#issuecomment-16782989 .

guyvanbael commented 11 years ago

i 've put it in framework/forms/uploadfield.php... but doesn't change a thing for me...

axyr commented 11 years ago

File UploadField.php Class UploadField_SelectHandler function getListField()

around rule 965

guyvanbael commented 11 years ago

found it, but doesn't change a thing... am i missing something?

mmichelli commented 11 years ago

I have the same issues.

guyvanbael commented 11 years ago

Seems fixed in the latest 3.1.x-dev version

On Fri, Jun 14, 2013 at 3:01 PM, Mario notifications@github.com wrote:

I have the same issues.

— Reply to this email directly or view it on GitHubhttps://github.com/silverstripe/silverstripe-framework/issues/1624#issuecomment-19455671 .