Jump to:

23487 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » ManyMany Grid Field Search Case Sensitive

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 403 Views
  • Futureweb
    Community Member
    232 Posts

    ManyMany Grid Field Search Case Sensitive Link to this post


    on our postres site, the manymany search is defaulting to case sensitive - making it pretty hard to field items.

    I've found a way of editing 'GridFieldAddExistingAutocompleter' in the core files to fix this, but is there a away of using somthing like 'setSearchFields' to for case sensititive / case insensitive searches?


  • Sam
    679 Posts

    Re: ManyMany Grid Field Search Case Sensitive Link to this post


    This has been fixed in 3.1, but if you're using 3.0 you can do this quick patch. Note that this will break other databases, which is why we haven't committed it to 3.0.

    --- a/forms/gridfield/GridFieldAddExistingAutocompleter.php
    +++ b/forms/gridfield/GridFieldAddExistingAutocompleter.php
    @@ -195,7 +195,7 @@ class GridFieldAddExistingAutocompleter
    // TODO Replace with DataList->filterAny() once it correctly supports OR connectives
    $stmts = array();
    foreach($searchFields as $searchField) {
    - $stmts[] .= sprintf('"%s" LIKE \'%s%%\'', $searchField,
    + $stmts[] .= sprintf('"%s" ILIKE \'%s%%\'', $searchField,
    $results = $allList->where(implode(' OR ', $stmts))->subtract($gridField->getList());

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.