Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Preview: DataObjectManager module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
Go to End
Author Topic: 61033 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Great catch. I've added that in.

  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    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 &nbsp;
          <% 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>

  • 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
    Community Member
    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?

    61033 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
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.