GridFieldAddExistingAutocompleter searches only Title or Name of related classes

Showing 1-4 of 4 messages
GridFieldAddExistingAutocompleter searches only Title or Name of related classes baba-papa 9/22/12 2:12 AM
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?
Re: GridFieldAddExistingAutocompleter searches only Title or Name of related classes Ingo Schommer 9/26/12 2:51 AM
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
Re: GridFieldAddExistingAutocompleter searches only Title or Name of related classes baba-papa 9/27/12 6:11 AM
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
Re: GridFieldAddExistingAutocompleter searches only Title or Name of related classes baba-papa 10/4/12 7:25 AM
I finished my work on this issue, provided a pull request, unit testing and documentation.