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 results form sort error


Reply


5 Posts   1575 Views

Avatar
timwjohn

Community Member, 98 Posts

4 April 2010 at 5:23am

Edited: 04/04/2010 5:35am

When attempting to sort the search results table in ModelAdmin I get an undefined index error. Here's the whole thing:

ERROR
[Notice] Undefined index: ResultAssembly
GET /wag/admin/library/Sector/ResultsForm/field/Sector?Name=&amp%3BResultAssembly%5BName%5D=Name&ctf%5BSector%5D%5Bsort%5D=Name

Line 672 in C:\xampp\htdocs\wag\cms\code\ModelAdmin.php

Source

663     *
664     * @param array $searchCriteria Limit fields by populating the 'ResultsAssembly' key
665     * @param boolean $selectedOnly Limit by 'ResultsAssempty
666     */
667    function getResultColumns($searchCriteria, $selectedOnly = true) {
668       $model = singleton($this->modelClass);
669
670       $summaryFields = $this->columnsAvailable();
671       
672       $resultAssembly = $searchCriteria['ResultAssembly'];
673       if($selectedOnly && $resultAssembly) {
674          
675          if(!is_array($resultAssembly)) {
676             $explodedAssembly = split(' *, *', $resultAssembly);
677             $resultAssembly = array();
678             foreach($explodedAssembly as $item) $resultAssembly[$item] = true;
Trace

ModelAdmin_CollectionController->getResultColumns(Array)
Line 697 of ModelAdmin.php
ModelAdmin_CollectionController->getResultsTable(Array)
Line 733 of ModelAdmin.php
ModelAdmin_CollectionController->ResultsForm(SS_HTTPRequest)
Line 193 of Controller.php
Controller->handleAction(SS_HTTPRequest)
Line 354 of ModelAdmin.php
ModelAdmin_CollectionController->handleActionOrID(SS_HTTPRequest)
Line 134 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 152 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 283 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
Line 127 of Director.php
Director::direct(/admin/library/Sector/ResultsForm/field/Sector)
Line 127 of main.php

I've stripped my ModelAdmin right down to the management of a single basic extended DataObject and emptied all custom tables from the database just to eliminate all errors I might have caused, I've even tried switching between beta-2 and rc-1 but it hasn't changed anything.

What is this ResultAssembly that for some reason doesn't seem to exist? Is anyone else getting this error? How can it be fixed?

Avatar
timwjohn

Community Member, 98 Posts

7 April 2010 at 3:14am

I know I wrote this at the beginning of the Easter Holidays. Just wondering if those of you that are back online have any ideas of how to fix this?

Avatar
timwjohn

Community Member, 98 Posts

9 April 2010 at 1:59am

If anybody has any info they can help me with, it would be greatly appreciated. Been going round in circles for ages with this :S

Thanks!

Avatar
Ingo

Forum Moderator, 801 Posts

14 April 2010 at 8:04am

Edited: 14/04/2010 8:12am

Good point, fixed in http://open.silverstripe.org/changeset/102712

Avatar
timwjohn

Community Member, 98 Posts

17 May 2010 at 11:41pm

Nice one Ingo. And congratulations to you guys on release 2.4. Silverstripe's looking good!