Great catch. I've added that in.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
DataObjectManager Module /
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
Preview: DataObjectManager module
The same problem occurs with sorting by column.
public function Headings() {
...
foreach($headings as $heading) {
...
$heading->SortLink = $this->RelativeLink(array(
'sort_dir' => $heading->SortDirection,
'sort' => $heading->Name
));
$heading->IsSortable = singleton($this->sourceClass)->hasField($heading->Name);
}
return $headings;
}
DataObjectManager.ss
<div class="pad">
<% if IsSortable %>
<a href="$SortLink">$Title
<% if IsSorted %>
<% if SortDirection = ASC %>
<img src="cms/images/bullet_arrow_up.png" alt="" />
<% else %>
<img src="cms/images/bullet_arrow_down.png" alt="" />
<% end_if %>
<% end_if %>
</a>
<% else %>
$Title
<% end_if %>
</div>
Thanks. I've already started making the update. Only thing I did differently was put the if clause within the <div class="pad">
How about ...?
public function setColumnWidths($widths) {
...
die('<strong>DataObjectManager::setColumnWidths()</strong>:' . _t('DataObjectManager.TOTALNOT100','Column widths must total 100 and not '.$total));
...
}
I don't like counting...
Yeah, I had that originally, but I don't think it gets along with the _t() function when you have a variable in the translated string.
That's right...
sprintf(_t('DataObjectManager.TOTALNOT100','Column widths must total 100 and not %s'), $total)
One more ...
If i set $sourceSort in the constructor of DataObjectManager(...) nothing is sorted. Please remove
protected function loadSort() {
if($this->ShowAll())
$this->setPageSize(999);
if($this->Sortable() && (!isset($_REQUEST['ctf'][$this->Name()]['sort']) || $_REQUEST['ctf'][$this->Name()]['sort'] == "SortOrder")) {
$this->sort = "SortOrder";
$this->sourceSort = "SortOrder ASC";
}
elseif(isset($_REQUEST['ctf'][$this->Name()]['sort']))
$this->sourceSort = $_REQUEST['ctf'][$this->Name()]['sort'] . " " . $this->sort_dir;
else
$this->sourceSort = null;
}
Hi, hopefully an easy question - How can I reverse the default sorting? Currently the oldest object is displayed first but ideally the newest one would be... any ideas?