-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update issue #41
Comments
I think you end up having two calendar instances and updating the wrong one. Please provide a JSfiddle or something so we can see the problem in the context of your application. |
Hey, thank you for your quick answer. $('#checkCalendarView').on('click', function (e) {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var arr = [];
database.transaction(function(tx) {
tx.executeSql('SELECT * FROM eventLog', [], function(tx, results) {
var len = results.rows.length;
for (var i = 0; i < len; i++) {
var begin = createDate(results.rows.item(i).data+ " " +results.rows.item(i).hour);
arr.push({
"summary": results.rows.item(i).type,
"begin": begin,
"end": begin
});
}
$("#calendar").jqmCalendar({
events : arr,
months: ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"],
days: ["Do","Lu", "Ma", "Me", "Gi", "Ve", "Sa"],
startOfWeek: 1
}, []);
}, function(err) {
console.log('ERROR Events: ' + JSON.stringify(err));
});
});
}); In addition I checked this on your .js $.fn.jqmCalendar = function(options) {
return this.each(function() {
if (!$(this).data('jqmCalendar')) {
$(this).data('jqmCalendar', new $.jqmCalendar(this, options));
}
}); And if I create a new istance the old one is of course showed and the new one is correctly populated. Where I am doing wrong? Thanks! |
Currently, a new events array can't be passed as options parameter for the update call. That should have been implemented but we never got to it. Have a look at this comment to see how to work around: #12 (comment) |
You can't do this this way. You should have something like this: var arr = [];
$('#view').on('pageinit', function() {
$("#calendar").jqmCalendar({
events : arr,
months: ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"],
days: ["Do","Lu", "Ma", "Me", "Gi", "Ve", "Sa"],
startOfWeek: 1
});
});
$('#checkCalendarView').on('click', function (e) {
database.transaction(function(tx) {
tx.executeSql('SELECT * FROM eventLog', [], function(tx, results) {
var len = results.rows.length;
for (var i = 0; i < len; i++) {
var begin = createDate(results.rows.item(i).data+ " " +results.rows.item(i).hour);
arr.push({
"summary": results.rows.item(i).type,
"begin": begin,
"end": begin
});
}
$("#calendar").trigger('update');
})
}) |
Ahhh I see the point. Nice solution! |
Clear the array first. http://stackoverflow.com/a/1232046/2104280 |
Peerfeect!! Btw great plugin, really! |
Life would have been so much easier if they just added a |
Hi there, all works as expected but there is a strange behaviour when users change day in calendar view. So basically even if events are already there (and the dot is showed just under the number) if a tap on the previous day and then I tap again on the fully populated day, no event is showed. It is seems like all is cleaned up. Do you think I need to listen to every change? I mean if my array is already populated do I need to repopulate again at every change? Let me know.. |
Strange, haven't seen this before. Is the same happening in the example? Then it might be an issue, if not, please share your event handler.
|
Hi there,
there is something strange that happen when I try to refresh the list of events.
So my situation is this one:
How can I trigger the refresh of the listview?
$("#calendar").trigger("refresh"); seems not working as well as $ ("#calendar").trigger('refresh', date); where date is today.
Can you help me, please?
Thanks!
The text was updated successfully, but these errors were encountered: