762 Posts in 312 Topics by 291 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 255 Views |
-
After dragging a widget, its method is not executed anymore [solved]

16 November 2011 at 6:11am Last edited: 16 November 2011 9:35pm
Hi,
i'm really confused about this really strange behaviour:
I'm working on a music band website with several widgets (for sidebar usage).I have a custom pagetype that shows a collection of tour dates.
Everything works as expected.Now there is a widget that shows up the next X dates inside a sidebar.
When this widget is dragged into the widget area and the page is saved - everything is still ok.
But when i drag the widget to a lower position (after an other widget) it does not work anymore.In detail:
the widget has a method which is called from the widget template:NextDatesWidget.php
class NextDatesWidget extends Widget {
...
function DateList()
{
Debug::dump('DateList called');
return DataObject::get('Tourdate', "DATE_FORMAT(Datum, '%Y%m%d') >= DATE_FORMAT(NOW(), '%Y%m%d')", 'Datum ASC', NULL, $this->NumberToShow);
}
...NextDatesWidget.ss
<% if DateList %>
<table id="Next-Dates">
<% control DateList %>
<tr>
<td>$Datum.Format(d.m.Y)</td>
<td>$Ort</td>
</tr>
<% end_control %>
</table>
<% else %>
<div>-no dates found-</div>
<% end_if %>After initial inserting the widget to the 1st position, the debug output shows up
After dragging the widget to an lower position, there is no debug output, even though the template is rendered.
And it shows the else condition "no dates found".Very confusing ....
Any ideas ?Greeting, Robert
Edit:
maybe a related thread?
http://www.silverstripe.org/widgets-2/show/17518Edit2:
Like posted in this thread: http://www.silverstripe.org/widgets-2/show/16123My /themes/mytheme/templates/WidgetHolder.ss file had the following content:
$Content
i had to wrap a "unique" named div around:
<div class="$ClassName">
$Content
</div>Now it works ....
| 255 Views | ||
|
Page:
1
|
Go to Top |

