Loading ...
Sorry, an error occurred while loading the content.

52386YUI Calendar automatic open events in DW SpryHTMLDataSet

Expand Messages
  • Robert
    Jan 31, 2010
    • 0 Attachment
      Hi I'm not a js script encoder, I will be happy if anyone can help me, and I search this forum forum for a answer.

      As it is now the events in my SpryHTMLDataSet open then I click on the date, and that's OK but what I will have is, after the YUI Calendar open the today events automatic open I a table below the calendar, but I would still keep the option to choose date to look at the events for that day, and then I deselect the date it reset to the today's events.
      -----------------------------------------------------------
      This is the code I'm use on my page now.

      <div id="yuicalendar1"></div>
      <script type="text/javascript">
      // BeginWebWidget YUI_Calendar: yuicalendar1

      (function() {
      var cn = document.body.className.toString();
      if (cn.indexOf('yui-skin-sam') == -1) {
      document.body.className += " yui-skin-sam";
      }
      })();

      var inityuicalendar1 = function() {
      var yuicalendar1 = new YAHOO.widget.Calendar("yuicalendar1");

      // The following event subscribers demonstrate how to handle
      // YUI Calendar events, specifically when a date cell is
      // selected and when it is unselected.
      //
      // See: http://developer.yahoo.com/yui/calendar/ for more
      // information on the YUI Calendar's configurations and
      // events.
      //
      // The YUI Calendar API cheatsheet can be found at:
      // http://yuiblog.com/assets/pdf/cheatsheets/calendar.pdf
      //
      //--- begin event subscribers ---//
      yuicalendar1.selectEvent.subscribe(selectHandler, yuicalendar1, true);
      yuicalendar1.deselectEvent.subscribe(deselectHandler, yuicalendar1, true);
      //--- end event subscribers ---//

      yuicalendar1.render();
      }

      function selectHandler(event, data) {
      var formattedDateString = data[0][0][1] + "/" + data[0][0][2] + "/" + data[0][0][0];
      var r = ordo.findRowsWithColumnValues({"Date": formattedDateString }, true);
      var region = Spry.Data.getRegion("classDetail");
      if(r){
      ordo.setCurrentRow(r.ds_RowID);
      region.setState("showClass", true);
      } else {
      region.setState("ready", true);
      }
      // The JavaScript function subscribed to yuicalendar1. It is called when
      // a date cell is selected.
      //
      // alert(event) will show an event type of "Select".
      // alert(data) will show the selected date as [year, month, date].
      };

      function deselectHandler(event, data) {
      // The JavaScript function subscribed to yuicalendar1. It is called when
      // a selected date cell is unselected.
      };

      // Create the YUI Calendar when the HTML document is usable.
      YAHOO.util.Event.onDOMReady(inityuicalendar1);

      // EndWebWidget YUI_Calendar: yuicalendar1
      </script>
      <br class="clearfloat" /><br />
      <div spry:detailregion="ordo" id="classDetail">
      <div spry:state="showClass">

      <table width="220">
      <tr>
      <td width="72">{datum}</td>
      <td width="136">{dag}</td>
      </tr>
      <tr>
      <td colspan="2">{Liturgisk_dag}</td>
      </tr>
      <tr>
      <td colspan="2">{Liturisk_färg} </td>
      </tr>
      <tr>
      <td colspan="2" class="tdRubrik">Mässtider/(int.) Vår Frälsares kyrka</td>
      </tr>
      <tr>
      <td height="33" colspan="2">{Tider_Gudstjänst} </td>
      </tr>
      <tr>
      <td colspan="2" class="tdRubrik">Läsningar</td>
      </tr>
      <tr>
      <td colspan="2">{Läsningar} </td>
      </tr>
      <tr>
      <td colspan="2" class="tdRubrik">Dagens aktivitet Vår Frälsares kyrka</td>
      </tr>
      <tr>
      <td colspan="2">{Aktiviteter}</td>
      </tr>
      <tr>
      <td colspan="2" class="tdRubrik">Kollekt</td>
      </tr>
      <tr>
      <td colspan="2">{Kollekt} </td>
      </tr>

      <tr>
      <td colspan="2" class="tdRubrik">Övrigt</td>
      </tr>
      <tr>
      <td colspan="2">{ordo::Övrigt}</td>
      </tr>
      </table>
      </div>
      <div spry:state="ready">
      Ordo/Veckonytt för denna dag/månad är inte är inte gjord!
      </div>
      <!--end Spry region--></div>

      <!--end #calendar--></div>