21489 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1961 Views |
-
Diplay DataObject in a popup via ajax?

10 July 2009 at 5:12am
I have a DataObject that contains some HTMLText and possibly a link to a file for download. When a front end user clicks a link I want a popup to show up and display the DataObject via an ss template. I am not sure how to go about this.
I do know how to make jQuery send an ajax request to a helper Controller that gets the DataObject that the user clicked on. However I don't know how to write the code that will render the DataObject with a template and send the link back to the client computer so that it can open a lightbox or similar with the url of the rendered data. I am not using a PageType for the DataObject.
-
Re: Diplay DataObject in a popup via ajax?

10 July 2009 at 2:06pm
I'm trying to do the exact same thing and I am equally as confused..
-
Re: Diplay DataObject in a popup via ajax?

1 September 2009 at 11:09pm
i am looking for some advice, too. How do implement an template.ss which does not interherit from page but from dataobject class?
Does anybody know a good tutorial?
-
Re: Diplay DataObject in a popup via ajax?

2 September 2009 at 6:14am
This may Help http://doc.silverstripe.org/doku.php?id=recipes:ajax_basics
Essentially you have to tell the object if its called with AJAX to render the data with differently.
There's a lot of good stuff in the Recipes section, but the Link to them isn't as obvious as it should be
http://doc.silverstripe.org/doku.php?id=recipes:startAlso check ssbit.com, it has some really well written tutorials explaining stuff better than some of the documentation
-
Re: Diplay DataObject in a popup via ajax?

3 September 2009 at 12:26am
Hi Zenmonkey,
thanks for your reply. I went through the ajax_basics and everything is working fine. But i am not sure where to go from here? I have got ajaxSnippet.ss Template that will be loaded into a <div> in page.ss. But what i need is to open the thickbox and load the ajaxSnippet.ss into the thickbox.
Link to open thickbox:
<a href="/silverstripe/ajax.php?refid=$ID&height=381&width=613" class="thickbox" title="$Headline">Link to load asynchronisly content into <div>:
<a href="$URLSegment" onclick="jQuery('#ajaxContent').load('$URLSegment/showImage'); return false;" >Can anybody help?
Greetings, Carsten.
-
Re: Diplay DataObject in a popup via ajax?

3 September 2009 at 1:52am Last edited: 3 September 2009 1:53am
I've never used Thickbox. I usually go with FaceBox or ColorBox. But you should just be able to structure your Thick box URL something like:
<a href="$Link?height=220&width=400" class="thickbox" title="$Headline">$Title</a>
But I'm not sure how the wrapping controls are structured. You're using $URLSegment which returns the Current Page Segment (ie everything after '/silverstripe/' which isn't the full link. You should be forming the link to point to the Dataobject as if it were a page. Silverstripe will see that the call is an AJAX call and render it accordingly. The only problem I can see is Silverstripe may not like the URL Parameters, so another Model Box Plug-in may be more useful.
At least thats where I'd start. Right now I'm just using modal boxes to hold login and review forms. I use jQuery to hide the div's, that way if the user has Javascript disabled they can still access the content. I find the solution is simpler. I tend to avoid Ajax calls for SEO reasons, and better degradation.
| 1961 Views | ||
|
Page:
1
|
Go to Top |




