21305 Posts in 5736 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1308 Views |
-
ajax load - renderWith - DataObjectSet - many_many

15 March 2011 at 1:50pm
HI
I have a dropdown field in my frontend and want to load special content via ajax after choosing a Kategorie (category)
Requesting via Ajax works fine... but I dont' know how to bring my valus I get with the DataObject::get() method to my template control snippet,..
that's my sql.. it works fine, (i've tested the sql statement in phpmyadmin. It returns several rows of Typ-Table which I connected to the Kategorie (with the ID 6) via an many_many relationship)
$doSet = DataObject::get(
$callerClass = "Kategorie",
$filter = "Kategorie.ID =6",
$sort="Typ.Bezeichnung ASC",
//$sort = "ORDER BY SortOrder DESC",
$join = "LEFT JOIN Kategorie_Typen ON Kategorie_Typen.KategorieID=Kategorie.ID LEFT JOIN Typ ON Kategorie_Typen.TypID=Typ.ID",
$limit = ""
);now id like to get that DataObject rendered with my Typ-Template
to use it in its control-tag
<% control Typ %>
$Bezeichnung
<% end_control %>something like that..:
return $doSet->renderWidth(array('TypTemplate'));
this causes two warnings and returns only the empty template:
1. DataObjectSet::__construct:Passed item #0 is not an object or assoziative array, can't properly iterated on in templates
2. Unknown class passed as parametersQuestions:
How to return my DataObjectSet to my Template and how can I control the data?Thanks in advance for any advice
Salut
Lukin -
Re: ajax load - renderWith - DataObjectSet - many_many

16 March 2011 at 6:21pm
Try call renderWith on the controller instance and adding your set to that
return $this->customize(new ArrayData(array('Typ' => $doSet)))->renderWith(array('TypTemplate'));
-
Re: ajax load - renderWith - DataObjectSet - many_many

17 March 2011 at 4:15am
Hi Willr
First it caused an error: method customize does not exist on 'Produkte_Controller'
so I tried it without the customize method and that works fine now
$data=new ArrayData(array('Typ' => $doSet));
return $data->renderWith(array('TypTemplate'));Thank s a lot !!
| 1308 Views | ||
|
Page:
1
|
Go to Top |


