Paul-DS / bootstrap-year-calendar

[DEPRECATED] A fully customizable year calendar widget, for boostrap !
Apache License 2.0
294 stars 243 forks source link

events url #183

Closed cressije closed 5 years ago

cressije commented 6 years ago

Hello Paul,

Je cherche comment ouvrir une url avec clickDay, en sachant que l'url se trouve dans chaques EVENT (url: 'http://www.google.fr') Je n'y connais presque rien en java, donc n'hésite pas à être très "basique" !!

Merci pour le travail, et merci d'avance de ton aide JL

Ammar-K commented 6 years ago

if all the URLs point to 'http://www.google.fr' then you can do something like:

$(function() {
    var currentYear = new Date().getFullYear();
    $('#calendar').calendar({
       clickDay: function(e) {
       if(e.events.length > 0) {
               window.open('http://www.google.fr', '_blank');
            }

I'm struggling myself to open unique URL for each event :(

cressije commented 6 years ago

Thanks but I search to open unique URL for each event

Eloytxo commented 6 years ago

You need to do:

1. Fill Datasource with your days: Add a property for your custom day event, like :

      var day={
             id: xxxxxxx,
             name: yyyyyyyyy,
             ...
             url: 'your custom url here',
             ....
     }

Push day into dataSource array. 2. Access the url property on render

    $j('#calendar').calendar({
       .....
      dataSource:dataSource,
      clickDay: function(e){
            window.open(e.events[0].url, '_blank');
        },
 });
Ammar-K commented 6 years ago

Many Thanks @Eloytxo This worked flawlessly.

cressije commented 5 years ago

Better late than never : thanks, works fine !