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.

Widgets /

Discuss SilverStripe Widgets.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

After dragging a widget, its method is not executed anymore [solved]

Go to End



Community Member, 78 Posts

16 November 2011 at 6:11am

Edited: 16/11/2011 9:35pm


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:


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);

                  <% if DateList %>
                      <table id="Next-Dates">
                          <% control DateList %>
                          <% end_control %>
                  <% 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

maybe a related thread?

Like posted in this thread:

My /themes/mytheme/templates/ file had the following content:


i had to wrap a "unique" named div around:

<div class="$ClassName">

Now it works ....