7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » DOM on the frontend
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 948 Views |
-
DOM on the frontend

17 September 2010 at 2:47am
I have seen a few threads on the forum about this topic, but the best suggestion I found for displaying data objects on the front end was to follow this: http://www.ssbits.com/using-silverstripe-url-parameters-to-display-dataobjects-on-a-page/
However, this does not work with 2.4.Has there been any progress implementing DOM on the frontend? For my purposes, I don't need (or want) the ability to add new data objects from the front end, but I like that the table can be sorted by column at the users will, it can be searched, and that it displays nicely in a popup when an object is clicked.
Thanks!
-
Re: DOM on the frontend

18 September 2010 at 1:55am Last edited: 18 September 2010 2:07am
Instead of a DOM-like dynamic table, I have just setup my template to display each data object in a regular table (one per row). What I would like to do now is open a popup to display the full details for the data object when the row is clicked. Can I somehow make use of some inbuilt DOM features to accomplish this, or will I have to start from scratch? Either way, I'd appreciate some suggestions for the best way approach this (advice/tutorials/forumthreads etc?)... I don't have a lot of experience with dynamic web content.
Thanks!
Edit: think I understand well enough how to get the right content for the right data object. Im more concerned about how to get the popup working.
-
Re: DOM on the frontend

10 December 2011 at 6:13pm
I'm looking for same functionality. Forms in CMS and in front for filling in some info OK.
But what I want in front is the information edited in tabular form (OK) bu I also want that visitor can click with mouse
on certain row => rowID is identified to be able to use the SS form mechanism => row data shows in a popup for edit and then save back => updated information shows immediately in tabular data in frontend. -
Re: DOM on the frontend

20 December 2011 at 12:48am
Hi,
You can use the DOM in frontend by calling the following method:
public function showFrontEndDOM() {
$tableField = new DataObjectManager(
$controller = $this,
$name = 'ObjectName',
$sourceClass = 'ObjectName',
$fieldList = array(
'ObjectVar' => 'TitleInDOM',
'ObjectVar' => 'TitleInDOM'
),
$callThisFunctionForPopupFields = 'getPopupFields',// function in Object
$sourceFilter = '',
$sort = ''
);
$tableField->setParentClass(false);$fields = new FieldSet(
new HiddenField('ID', ''),
$tableField
);$actions = new FieldSet();
return new Form($this, 'showFrontEndDOM', $fields,$actions);
}With tableField->setPermissions(); whitin the method you can set the allowed actions like add, remove, delete and show.
I hope this will helps.
-
Re: DOM on the frontend

31 March 2012 at 12:26am
Hmmmm I have it almost working. Well I can add objects via the frontend DOM now, but I cant figure out the relationships.
here's my code:
function RatesForm(){
$Apartment = $this->getApartment();
$Manager = new DataObjectManager(
$this->dataRecord,
'Rates',
'Rates',
array('dateStart' => 'dateStart'),
'getCMSFields_forPopup',
'ApartmentID = ' . $Apartment->ID
);$Manager->setPermissions(array("show","edit", "add"));
$fields = new FieldSet(
$Manager
);
if($Apartment) {
$fields->push(new HiddenField('ID','ID',$Apartment->ID));
}
return new Form($this->dataRecord, 'RatesForm', $fields, new FieldSet());
}So that lists all the rates related to this apartment fine, but I can't edit them, clicking them throws up this error: [Notice] Trying to get property of non-object which is because I have the filter in there based on a $this request for apartment. as soon as you click the dataObject the URL changes and as a result there's no apartment to get an ID from.
As you can see I've put the Apartment ID into the form with a hidden field, but I can't figure out how to pass that to the DOM pop up.... if I take out the filter I can add/edit rates fine, but I need to make sure the user only see's the rates related to this apartment. I hope that makes sense!can anybody shed any light on this?
P.S - my pop up still doesn't work either, it just opens a new page with the form fields, but I assume that can be fixed later, the pop up doesn't matter to the actual functionality, right?
| 948 Views | ||
|
Page:
1
|
Go to Top |




