Added ModelAdmin:: for changing the class used to generate results tables

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@67165 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-12-02 09:33:53 +00:00
parent 1c98c2e8e5
commit 6d45e58587

View File

@ -96,6 +96,19 @@ abstract class ModelAdmin extends LeftAndMain {
*/
protected static $page_length = 30;
/**
* Class name of the form field used for the results list. Overloading this in subclasses
* can let you customise the results table field.
*/
protected $resultsTableClassName = 'TableListField';
/**
* Return {@link $this->resultsTableClassName}
*/
public function resultsTableClassName() {
return $this->resultsTableClassName;
}
/**
* Initialize the model admin interface. Sets up embedded jquery libraries and requisite plugins.
*
@ -582,7 +595,8 @@ class ModelAdmin_CollectionController extends Controller {
if($searchCriteria instanceof HTTPRequest) $searchCriteria = $searchCriteria->getVars();
$summaryFields = $this->getResultColumns($searchCriteria);
$tf = new TableListField(
$className = $this->parentController->resultsTableClassName();
$tf = new $className(
$this->modelClass,
$this->modelClass,
$summaryFields