mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-08-25 12:05:43 +02:00
Merge pull request #687 from ajshort/gridfield-search-list
Make the list used for autocomplete search results settable.
This commit is contained in:
commit
823f0f7749
@ -21,6 +21,11 @@ class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridF
|
||||
*/
|
||||
protected $targetFragment;
|
||||
|
||||
/**
|
||||
* @var SS_List
|
||||
*/
|
||||
protected $searchList;
|
||||
|
||||
/**
|
||||
* Which columns that should be used for doing a "StartsWith" search.
|
||||
* If multiple fields are provided, the filtering is performed non-exclusive.
|
||||
@ -167,8 +172,12 @@ class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridF
|
||||
* @param SS_HTTPRequest $request
|
||||
*/
|
||||
public function doSearch($gridField, $request) {
|
||||
$dataClass = $gridField->getList()->dataClass();
|
||||
$allList = DataList::create($dataClass);
|
||||
if($this->searchList) {
|
||||
$allList = $this->searchList;
|
||||
} else {
|
||||
$allList = DataList::create($gridField->getList()->dataClass());
|
||||
}
|
||||
|
||||
$filters = array();
|
||||
$stmts = array();
|
||||
|
||||
@ -209,6 +218,16 @@ class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridF
|
||||
return $this->resultsFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the base list instance which will be used for the autocomplete
|
||||
* search.
|
||||
*
|
||||
* @param SS_List $list
|
||||
*/
|
||||
public function setSearchList(SS_List $list) {
|
||||
$this->searchList = $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Array
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user