7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Sort and CSV export
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1061 Views |
-
Sort and CSV export

23 January 2011 at 1:49am
For some reason I can't sort columns in a DataObjectManager view. When I click on a column header, the direction arrow changes and it puts DESC or ASC to the url request to RootForm, but it always sort by ASC. I updated to the latest svn version of the DataObjectManager. Anyone have any idea how to fix this?
And I've seen a few forum posts where it's said that the DataObjectManager has CSV export built in, but I can't find it. Does anyone know how to enable this?
Thanks in advance!
-
Re: Sort and CSV export

25 July 2011 at 3:32am Last edited: 25 July 2011 3:44am
I actually believe the fault here lies with TableListField.php. In 2.4.5, the Headings() function lines 335 to 339 are:
if(!empty($_REQUEST['ctf'][$this->Name()]['sort']) && ($_REQUEST['ctf'][$this->Name()]['sort'] == $fieldName)) {
$dir = isset($_REQUEST['ctf'][$this->Name()]['dir']) ? $_REQUEST['ctf'][$this->Name()]['dir'] : null;
$dir = trim(strtolower($dir));
$newDir = ($dir == 'desc') ? null : 'desc';
$sortLink = HTTP::setGetVar("ctf[{$this->Name()}][dir]", Convert::raw2xml($newDir), $sortLink,'&');
}whereas changing all instances of ['dir'] to ['sort_dir'] re-enables DOM sorting functionality, like so:
if(!empty($_REQUEST['ctf'][$this->Name()]['sort']) && ($_REQUEST['ctf'][$this->Name()]['sort'] == $fieldName)) {
$dir = isset($_REQUEST['ctf'][$this->Name()]['sort_dir']) ? $_REQUEST['ctf'][$this->Name()]['sort_dir'] : null;
$dir = trim(strtolower($dir));
$newDir = ($dir == 'desc') ? null : 'desc';
$sortLink = HTTP::setGetVar("ctf[{$this->Name()}][dir]", Convert::raw2xml($newDir), $sortLink,'&');
}What this doesn't solve however, is the fact that once I've clicked any column headings in the DOM, I then get the 'are you sure you want to navigate away from this page' prompt, even though no changes to data have occurred... I'm trawling through LeftAndMain_right.js and although I've found the 'confirmation' variables in the autoSave function, I don't want to disable confirmation in general.
Tips greatly appreciated.
-
Re: Sort and CSV export

27 July 2011 at 1:23am
Yeah, the alert message is a really tough bug to fix. The Javascript that controls that behavior is very, very sensitive, and simple things like changing the attributes of the wrapping element of the DOM will cause it to return false positives. It's annoying.. I went through it with Uploadify and it was a real pain to solve.
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com
| 1061 Views | ||
|
Page:
1
|
Go to Top |


