Jump to:

7911 Posts in 1354 Topics by 930 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Preview: DataObjectManager module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Go to End
Author Topic: 54218 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Thanks. I've already started making the update. Only thing I did differently was put the if clause within the <div class="pad">

  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    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...

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    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.

  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    That's right...

    sprintf(_t('DataObjectManager.TOTALNOT100','Column widths must total 100 and not %s'), $total)

  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    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;

    }

  • Howard
    Avatar
    Forum Moderator
    215 Posts

    Re: Preview: DataObjectManager module Link to this post

    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?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Default sort is the 7th (8th in filedataobjectmanager) argument of the field. Check the api on complextablefield.

  • Howard
    Avatar
    Forum Moderator
    215 Posts

    Re: Preview: DataObjectManager module Link to this post

    I had a play with that and added 'DESC' which didn't do anything, so I tried 'ASC' then 'Date DESC' etc but nothing made a difference. Is there something that I am doing wrong?

    $manager = new DataObjectManager(
       $this, // Controller
       'PlanningComments', // Source name
       'PlanningComment', // Source class
       array('Date' => 'Date', 'Name' => 'Name', 'PlanningComment' => 'Comment'), // Headings
       'getCMSFields_forPopup', // Detail fields function or FieldSet   
       '', // Filter clause
       'DESC', // Sort clause
       ''// Join clause

    54218 Views
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.