GridFieldAddExistingAutocompleter searches only Title or Name of related classes

80 views
Skip to first unread message

baba-papa

unread,
Sep 22, 2012, 5:12:03 AM9/22/12
to silverst...@googlegroups.com
I like the idea of adding relations with an autocomplete field.Our ecommerce module SilverCart often deals with large amounts of objects and the checkboxes of the ComplexTableField and its descendants weren't very user friendly.
However, the GridFieldAddExistingAutocompleter just searches the attributes 'Title' and/or 'Name' of the related object:
protected function scaffoldSearchFields($dataClass) {
$obj = singleton($dataClass); 
if($obj->hasDatabaseField('Title')) {
return array('Title');
} else if($obj->hasDatabaseField('Name')) {
return array('Name');
} else {
return null;
}
}
In case these fields do not exist the autocompleters request throws an exception.
I expected the autocompleter to use the information of the searchableFields() array. In SilverCart we often need to search the attributes of a further relation. For searchableFields() this was passible with dot-notation.
Should I provide a patch for this or is anyone still working on this issue?

Ingo Schommer

unread,
Sep 26, 2012, 5:51:49 AM9/26/12
to silverst...@googlegroups.com
Hello Roland,

Yep, I think that's patch-worthy, since it kind of breaks developer expectations at the moment. 
If we have a thing called "searchable fields", it should be used consistently.

There's a couple of tickets around this

BTW: In case you encounter problems with dot notation,
those most likely need to be fixed in DataList and DataQuery, not in GridField itself.

Patch away! :)
Ingo

baba-papa

unread,
Sep 27, 2012, 9:11:38 AM9/27/12
to silverst...@googlegroups.com
Hello Ingo,

tanks for your answer. I wasn't aware of the tickets.
Sebastian and me are already working on this issue. We should be done by the end of next week.

Greetings,
Roland

baba-papa

unread,
Oct 4, 2012, 10:25:55 AM10/4/12
to silverst...@googlegroups.com
I finished my work on this issue, provided a pull request, unit testing and documentation.
Reply all
Reply to author
Forward
0 new messages