Telerik Forums
Kendo UI for jQuery Forum
1 answer
321 views
$("#mycalendar").kendoCalendar({
            value: today,
            dates: events,
            change: onChangeCalendar,
                month: {
                // template for dates in month view
                content: 
                     '# if ($.inArray(+data.date, data.dates) != -1) { #' +
                        '<div class="' +
                               "exhibition" +
                        '">#= data.value #</div>' +
                     '# } else { #' +
                     '#= data.value #' +
                     '# } #'
              },
              footer: false
    });

I have my Calendar with onChange function and i'd like to create onSelect function.

At my onChange i create a kendo window to show a message.

This should also happen at onSelect.

-Click element.
-Go to onchange

-Open the window

-Close window
-I click on the same item and it does not open (onSelect is not implemented)

Calendar don't have select event.

How can i do this?

Stefan
Telerik team
 answered on 21 Nov 2017
1 answer
74 views

I want the calendar to display 3 months instead of 1. 

Also, the user should be able to multi select the dates in these 3 months.

 

What is the way to implement this?

 

Thanks.

Eduardo Serra
Telerik team
 answered on 22 Sep 2017
1 answer
136 views

Hi Telerik,

Is it possible to set the width of event A to 80% and width of event B to 20% ?

Thanks

 

Dimitar
Telerik team
 answered on 21 Sep 2017
1 answer
89 views

Hello,
How can I get the selected month from a kendoCalendar??

the kendoCalendar it is in a window partialview:

<table class="table table-responsive">
    <tr>
        @*<td style="vertical-align: initial; padding-right: 100px;">
                <input id="picker" />
            </td>*@
        <td>
            <img src="~/Content/calendar.png" class="img-responsive" />
        </td>
        <td>
            <div id="calendar"></div>
        </td>
    </tr>
    <tr>
        <td>
            <button align="right" id="btnAddMonth" class="k-primary" onclick="SaveMonth();" style="height:2em;width:auto">Salveaza</button>
        </td>
    </tr>
</table>
i have this code behind:
$(function() {
var listaZile=[];
  var today = new Date();
    //data source
  var selectedDates = [today.getDate() ];
  //Calendar with multiselection
  initCalendar($("#calendar").kendoCalendar(), selectedDates.slice());
});

function initCalendar(calendar, selectedDates, onUpdate) {
  var kendoCalendar = calendar.data('kendoCalendar');

  kendoCalendar.bind('navigate', function() {
    setTimeout(function() {
      updateCalendar(calendar, selectedDates);
    }, 0);
  });

  updateCalendar(calendar, selectedDates);

  calendar.on('click', function(event) {
    var cell = $(event.target).closest('td');
    var isClickedOnDayCell = cell.length !== 0 && isDayCell(cell);

    if (isClickedOnDayCell) {
      var date = dateFromCell(cell).getDate();
      var isDateAlreadySelected = selectedDates.some(function(selected) {
        return selected === date;
      });

      if (isDateAlreadySelected) {
        selectedDates.splice(selectedDates.indexOf(date), 1);

      } else {
        selectedDates.push(date);
listaZile.push(date); //this return days selected!!!
      }

      updateCell(cell, selectedDates);

      if (onUpdate !== undefined) {
        onUpdate();
      }
    }
  });
}


function updateCalendar(calendar, selectedDates) {
  calendar.find('td > a').parent().each(function(i, item) {
    var cell = $(item);

    if (isDayCell(cell)) {
      updateCell(cell, selectedDates);
    }
  });
}

function updateCell(cell, selectedDates) {
  var isCellSelected = selectedDates.some(function(selected) {
    return selected === dateFromCell(cell).getTime();
  });

  if (isCellSelected) {
    cell.addClass('selected');

  } else {
    cell.removeClass('selected');
  }
}

function isDayCell(cell) {
  return /^\d{1,2}$/.test(cell.find('a').text());
}

function dateFromCell(cell) {
  return new Date(convertDataValue(cell.find('a').attr('data-value')));
}

//convert from 'YYYY/MM/DD', where MM = 0..11
function convertDataValue(date) {
  var regex = /\/(\d+)\//;
  var month = +date.match(regex)[1] + 1;

  return date.replace(regex, '/' + month + '/');
}

 

The save function :

<script type="text/javascript">
   
    function SaveMonth() {
          iMonth = document.getElementById('calendar_cell_selected').textContent;
        //var month=iMonth
        alert(iMonth);
        var year = 2017;
        debugger;

        var url = '@Url.Action("Adauga", "Calendar")';

        $.ajax({
            type: "POST",
            url: url,
            dataType: "json",
            data: { listZile: listZile, iMonth: iMonth, iYear: year },
            success: function (data, status) {
                //$("#AdaugaL").html("")
                $("#AdaugaL").html("");
                var wnd = $("#AdaugaL").data("kendoWindow");
                wnd.close();
                $("#GridProgramLucru").data("kendoGrid").dataSource.read();
                $("#GridProgramLucru").data("kendoGrid").refresh();
            },
            error: function (result) {
                debugger;
            },
        })
    }
</script>
P.S I attached a view of my calendar window. the get value from month selection is undefined.
Thank you.

Preslav
Telerik team
 answered on 26 May 2017
1 answer
693 views

Hello,

How can I get the selected month from a kendoCalendar??

i have this code behind:

$(function() {

var listaZile=[];
  var today = new Date();
    //data source
  var selectedDates = [today.getDate() ];

  //Calendar with multiselection
  initCalendar($("#calendar").kendoCalendar(), selectedDates.slice());
});

function initCalendar(calendar, selectedDates, onUpdate) {
  var kendoCalendar = calendar.data('kendoCalendar');

  kendoCalendar.bind('navigate', function() {
    setTimeout(function() {
      updateCalendar(calendar, selectedDates);
    }, 0);
  });

  updateCalendar(calendar, selectedDates);

  calendar.on('click', function(event) {
    var cell = $(event.target).closest('td');
    var isClickedOnDayCell = cell.length !== 0 && isDayCell(cell);

    if (isClickedOnDayCell) {
      var date = dateFromCell(cell).getDate();
      var isDateAlreadySelected = selectedDates.some(function(selected) {
        return selected === date;
      });

      if (isDateAlreadySelected) {
        selectedDates.splice(selectedDates.indexOf(date), 1);

      } else {
        selectedDates.push(date);

listaZile.push(date); //this return days selected!!!
      }

      updateCell(cell, selectedDates);

      if (onUpdate !== undefined) {
        onUpdate();
      }
    }
  });
}


function updateCalendar(calendar, selectedDates) {
  calendar.find('td > a').parent().each(function(i, item) {
    var cell = $(item);

    if (isDayCell(cell)) {
      updateCell(cell, selectedDates);
    }
  });
}

function updateCell(cell, selectedDates) {
  var isCellSelected = selectedDates.some(function(selected) {
    return selected === dateFromCell(cell).getTime();
  });

  if (isCellSelected) {
    cell.addClass('selected');

  } else {
    cell.removeClass('selected');
  }
}

function isDayCell(cell) {
  return /^\d{1,2}$/.test(cell.find('a').text());
}

function dateFromCell(cell) {
  return new Date(convertDataValue(cell.find('a').attr('data-value')));
}

//convert from 'YYYY/MM/DD', where MM = 0..11
function convertDataValue(date) {
  var regex = /\/(\d+)\//;
  var month = +date.match(regex)[1] + 1;

  return date.replace(regex, '/' + month + '/');
}

P.S I attached a view of my calendar window. the get value from month selection is undefined.

Thank you.

Preslav
Telerik team
 answered on 26 May 2017
1 answer
149 views
We are experiencing an issue on the calendar on touch devices, when a user taps the next or previous month buttons it skips a month each time, so for example it would go from January to March.

I'm pretty sure we haven't altered any of the Kendo functionality so it should still be working as it was created. I want to test a demo on your site of the calendar from the version we're using (version 2015.2.624) to see if the issue occurs on your end as well. Is there any way we can test a demo from the past versions?
Stefan
Telerik team
 answered on 02 May 2017
8 answers
854 views

Hi,

I am new to the Kendo U, and I am trying to build the app using UI calendar with Angular JS. Please help me with the solution.

 

Is it possible to disable the weekends of the particular month. For example, I am using april month. In here I need to disable the weekends and some days also, like 15 and 16 dates. Please provide the solution on how to achieve it. sample given below.

 

Your solution will help me with the product.

http://dojo.telerik.com/oMoDU/4 

 

Regards,

Dhinesh R

Dhinesh
Top achievements
Rank 1
 answered on 27 Apr 2017
3 answers
93 views

 Hi, 

 The first week of January is looking to be 2, not 1. What can  be the explanation? 

 

Regards, 

   Cristina

 

 

 

 

Boyan Dimitrov
Telerik team
 answered on 10 Apr 2017
10 answers
234 views
Hello KendoUI Team

I'd like to know what is best option (if exist one) to have week number in the calendar.
The idea is to have exactly what we have with ASP.NET AJAX controls:
http://demos.telerik.com/aspnet-ajax/calendar/examples/functionality/mainareacustomization/defaultcs.aspx

Regards

Guilherme
Boyan Dimitrov
Telerik team
 answered on 07 Apr 2017
4 answers
144 views

Hi, we're using the Bootstrap theme throughout our site and I've noticed that the KendoCalendar doesn't seem to have consistent bootstrap styling?

(See attached image)

I would expect it to have Border Radius applied and also some drop shadow?

Am I missing something or is this the case for everyone?

Alanm
Top achievements
Rank 2
 answered on 20 Feb 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?