Jump to:

796 Posts in 409 Topics by 304 members


SilverStripe Forums » Widgets » After dragging a widget, its method is not executed anymore [solved]

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 393 Views
  • rob.s
    Community Member
    78 Posts

    After dragging a widget, its method is not executed anymore [solved] Link to this post


    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: http://www.silverstripe.org/widgets-2/show/16123

    My /themes/mytheme/templates/WidgetHolder.ss file had the following content:


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

    <div class="$ClassName">

    Now it works ....

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.