Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

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

attn uncle cheese - dataObjectManager bug?


Go to End


32 Posts   7147 Views

Avatar
Rawbit

Community Member, 52 Posts

5 May 2009 at 7:08am

UncleCheese et all:

For some reason I can't get one of my dataobjectmanager to drag and drop. When I hit the checkbox, and hover over the items, it shows the cursor as if it wants to reorder - but they just stay stuck. All of the other dataObjectManager items on this site are sortable - just not this one!

Any ideas what might be going on?

I have this in _config.php:

SortableDataObject::add_sortable_class('RelatedLink');

And here is RelatedLink.php

<?php
class RelatedLink extends DataObject
{
	static $db = array (
		'Title' => 'Text',
		'Address' => 'Text'
	);
	
	static $has_one = array (
		'Page' => 'Page'
	);
		
	public function getCMSFields_forPopup()
	{
		return new FieldSet(
			new TextField('Title'),
			new TextField('Address')
		);
	}
}
?>

And the part in Page.php

$fields->addFieldToTab("Root.Content.RelatedLink", new DataObjectManager(
			$this,
			'RelatedLinks',
			'RelatedLink',
			array('Title' => 'Title','Address'=>'Address'),
			'getCMSFields_forPopup'
		));

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 May 2009 at 8:21am

Dude, I've got no idea. If you're getting the move cursor, it means the interface has refreshed properly and it has applied the sort controls. Weird that others are working. Have you tried different browsers? Any javascript errors?

Avatar
klikhier

Community Member, 150 Posts

2 July 2009 at 12:47am

G'day Uncle Cheese,

Have the exact same issue here.

_config.php

...
SortableDataObject::add_sortable_classes(array('Characteristic','Reference','Photo'));
...

Characteristic.php

<?php

class Characteristic extends DataObject
{
	static $db = array (
		'Label' => 'Text',
		'Value' => 'Text'
	);
	
	static $has_one = array (
		'DesignDetailsPage' => 'DesignDetailsPage'
	);
	
	public function getCMSFields_forPopup()
	{
		return new FieldSet(
			new TextField('Label',"Label (example: 'Length over all')"),
			new TextField('Value',"Value (example: '45.50 m')")
		);
	}

  function PrincipalCharacteristics() {
    if ($this->iteratorPos < 4) {
      return true;
    }
  }

}

class Characteristic_Controller extends ContentController {
	
}

?>

DesignDetailsPage.php

...
  static $has_many = array(
    'Characteristics' => 'Characteristic',
    'References' => 'Reference',
    'Photos' => 'Photo'
  );
...
		$manager2 = new DataObjectManager(
			$this, // Controller
			'Characteristics', // Source name
			'Characteristic', // Source class
			array(
				'Label' => 'Label', 
				'Value' => 'Value'
			), // Headings 
			'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
			// Filter clause
			// Sort clause
			// Join clause
		);

		$fields->addFieldToTab('Root.Content.Characteristics', $manager2);
...

I'm sure this worked when I was developing the site, but currently (customer is already using CMS) drag&drop doesn't work anymore in none of the DOM-pages (in my case: Characteristics and Clients). Strange thing is that drag&drop does work on my ImageDOM (Photos). Tested in FF en IE7 and didn't work in both browsers.

Installed modules: userforms, cmsworkflow, swfupload, dataobjectmanager. SS version 2.3.1.

Avatar
klikhier

Community Member, 150 Posts

7 July 2009 at 7:52pm

Anything uncle cheese? I just cant' find out what's going wrong, but drag&drop is still not working... Pls help :)

Avatar
UncleCheese

Forum Moderator, 4102 Posts

8 July 2009 at 1:25am

Edited: 08/07/2009 1:25am

I can't replicate the issue, so it's really hard for me to troubleshoot. I have almost 20 production sites running DOM instances and none of them have ever reported this problem, so it's clearly an edge case. If you can figure out what causes it, please let me know and I'll test and fix, but with nothing to go on, I really can't sink time into investigating the problem.

Edit: You are on the latest SVN, correct? And SS 2.3.2?

Avatar
klikhier

Community Member, 150 Posts

8 July 2009 at 1:45am

Thanks for your reply uncle cheese. Am not on latest svn and site has gone live with SS 2.3.1. Do you think getting the latest version of DOM could solve the issue? I'll go and try that later this week, thanks.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

8 July 2009 at 1:50am

Also, do you have more than one DOM instance on a page? e.g., on different tabs?

Avatar
klikhier

Community Member, 150 Posts

8 July 2009 at 1:58am

Yes, I have three different tabs. Two normal DOMs and one ImageDOM.

Go to Top