Jump to:

7921 Posts in 1359 Topics by 933 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: 54684 Views
  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    Hi Howard,

    "Sort clause" means column and sort direction. So you have to select a column. i.e

    ...
    '', // Filter clause
    'Date DESC', // Sort clause
    ''// Join clause
    ...

    But protected function loadSort() {...} in DataObjectManager.php overrides this value to null. So you have to remove this line

    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

    Great that worked Thanks hu

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Shouldn't have to make that change in the latest version.

  • Ben Gribaudo
    Avatar
    Community Member
    181 Posts

    Re: Preview: DataObjectManager module Link to this post

    Hi,

    I'm running revision 103 of DataObjectManager against revision 73881 of trunk. When I click the "save" button on the "add" pop-up window, the object I'm trying to add never gets saved to the database. Instead, I get sent to some kind of page that has an add link and a search box, etc.

    The "add" pop-up window's form tag is as follows:
    <form id="DataObjectManager_Popup_AddForm" action="admin/EditForm/field/Articles?ctf[Articles][per_page]=10&amp;ctf[Articles][showall]=0&amp;ctf[Articles][sort]=Created&amp;ctf[Articles][sort_dir]=DESC&amp;ctf[Articles][search]=&amp;ctf[Articles][filter]=" method="post" enctype="application/x-www-form-urlencoded">

    Is that the correct action? It looks funny to me.

    Thanks,
    Ben

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    That's the right link. Can you post a screenshot? Some code?

  • Ben Gribaudo
    Avatar
    Community Member
    181 Posts

    Re: Preview: DataObjectManager module Link to this post

    Thanks for the fast response! Image (which appears after I click save) & code attached.

    Ben

    Attached Files
  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Now that I take a closer look, that is the wrong form action. It should be admin/EditForm/field/Article/AddForm?ctf....

    Hmm....

  • dynamite
    Avatar
    Community Member
    66 Posts

    Re: Preview: DataObjectManager module Link to this post

    Thanks for the wonderful module!

    I am relative noob to SilverStripe (but not PHP and object oriented coding), and was wondering if anyone would like to share some tips and/or code on utilizing the DataObjectManager into the front-end templates? I would like to create a gallery, organized by category, and I have it all working from the CMS, but am pretty directionless for the next step.

    Thanks in advance!

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