Comments (10)
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.
from jqm-calendar.
Hey, thank you for your quick answer.
In short this is the action related to the click on "Check Calendar View". All the event come out from a db.
$('#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!
from jqm-calendar.
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)
from jqm-calendar.
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');
})
})
from jqm-calendar.
Ahhh I see the point. Nice solution!
Have you any idea how to manage doubled entry?
from jqm-calendar.
Clear the array first. http://stackoverflow.com/a/1232046/2104280
from jqm-calendar.
Peerfeect!!
Sometimes I forget the basics... ;)
Btw great plugin, really!
from jqm-calendar.
Life would have been so much easier if they just added a clear()
function to the array 😉 Glad you like it and the plugin is still being used! (It's from 2013 😊 )
from jqm-calendar.
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..
BigG
from jqm-calendar.
from jqm-calendar.
Related Issues (20)
- Issues with jQuery Mobile 1.4.2
- refresh not working HOT 1
- Enable dynamic loading of events
- Taphold HOT 2
- Change in calendar options does not get triggered after refresh HOT 11
- Ignore button when searching for events HOT 2
- Buttons to change year HOT 2
- Disable past dates HOT 8
- eventhandler must contain all events in order to work HOT 5
- Question: What would be involved in upgrading jqm-calendar to JQM 1.4.5? HOT 3
- Wrong next month HOT 20
- Last version does not work (at least on Chrome desktop and mobile) HOT 8
- new Date(2015,09,05,10,30) format shows up 1 month later HOT 1
- demo HOT 1
- full year view HOT 3
- Calendar not working in Compiled APP. HOT 1
- Problems to see the correct Date HOT 1
- Display evends in the calendar HOT 2
- Dates HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jqm-calendar.