Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » ModelAdmin: Wrong datarecords in ResultSet

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

Page: 1
Go to End
Author Topic: 837 Views
  • Matze0681
    Avatar
    Community Member
    25 Posts

    ModelAdmin: Wrong datarecords in ResultSet Link to this post

    Hi,

    i got a problem that there are wrong datarecords displayed in one Models Results. I got Countries which has_many Schools and one School has_one Country. But in ModelAdmin results (just in some countries) are Schools listet which are related to another country than the selectet. I checked the database entries for both schools and countries and the relations are setup correctly there.. One School got one CountryID and only exists once, but some schools are shown in different Countries.

    Couldnt find out anything about that problem in the Internet.

    Did somebody experience a similar problem with perhaps possible cause of that error ? Perhaps a ModelAdmin Bug ?

    thanks in advance
    matze

  • Matze0681
    Avatar
    Community Member
    25 Posts

    Re: ModelAdmin: Wrong datarecords in ResultSet Link to this post

    Nobody got an advice? really stuck with that...

    I attached an example screenshot to this post. There u can see we are in the Country "Angleterre", but the first two Schools/Cities are in Spain (The database entries / relations are pointing to the correct ID(Spain) from these Schools!!). The Entry(Result Count) is wrong too. There are no 30 Entries in the Displayed Resultset...

    any ideas ?

    Attached Files
  • Matze0681
    Avatar
    Community Member
    25 Posts

    Re: ModelAdmin: Wrong datarecords in ResultSet Link to this post

    im getting a step forward with that..

    i know where the error comes from, but not how to solve it.

    The error appears only in Schools which CountryID >= 10

    and for example:
    in ModelAdmin when i select the School
    -> with ID 1 -> Entries from ID 10 and 13 are shown in the result table( + the correct entries with ID 1)
    -> with ID 2 -> Entries from ID 12 are shown in the result table (+ the correct entries with ID 2)
    -> with ID 3 -> Entries from ID 13 are shown (+ the correct entries with ID 3)
    ...

    Does that help you to help me ? ;)

  • Matze0681
    Avatar
    Community Member
    25 Posts

    Re: ModelAdmin: Wrong datarecords in ResultSet Link to this post

    the problem was that the default Filter for searchable_fields = PartialMatchFilter. So the search found everthing LIKE %ID%

    Solution:

       static $searchable_fields = array(
          'Name',
          'Country.ID' => 'ExactMatchFilter'
       );

    837 Views
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.