Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

ModelAdmin: Wrong datarecords in ResultSet


Reply

4 Posts   851 Views

Avatar
Matze0681

11 May 2010 at 10:13am Community Member, 25 Posts

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

Avatar
Matze0681

19 May 2010 at 11:20am Community Member, 25 Posts

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
Avatar
Matze0681

20 May 2010 at 11:01am Community Member, 25 Posts

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 ? ;)

Avatar
Matze0681

20 May 2010 at 1:30pm Community Member, 25 Posts

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'
   );