i have a JSON string here:
[{"title":"Event","start":"2017-04-23T18:00:00","end":"2017-04-23T18:00:00"},{"title":"Event 2","start":"2017-04-23T11:15:00","end":"2017-04-23T11:15:00"},{"title":"Event 3","start":"2017-04-26T08:32:00","end":"2017-04-26T08:32:00"}]
how can I add those events in my calendar? (maybe using a loop?)
TRY THIS
$('#calendar').fullCalendar({
events: [
{
title : 'event1',
start : '2010-01-01'
},
{
title : 'event2',
start : '2010-01-05',
end : '2010-01-07'
},
{
title : 'event3',
start : '2010-01-09T12:30:00',
allDay : false // will make the time show
}
]
});
Related
How can I get now hours, for time property messagesList in VueCLI? When i clicked button, this property is filled as time now. time property will be decimal part. Example : (23.14)
Data is there :
messagesList : [
{
id : 1,
content : "Benim mesajım",
opposite : false,
me : true,
time : 23.13,
},
{
id : 2,
content : "Karşı tarafın mesajı",
opposite : true,
me : false,
time : 23.13,
}
],
Code is there :
this.messagesList.push(
{
id : this.messagesList.length + 1,
content : this.inputText,
opposite : false,
me : true,
time : ?,
}
Just create a function to return the current time in the format you want and call it when adding in the message.
Here is the function:
function getTime() {
return parseFloat(`${new Date().getHours()}.${new Date().getMinutes()}`)
}
Here is the push to messageList:
this.messagesList.push({
id: this.messagesList.length + 1,
content: this.inputText,
opposite: false,
me: true,
time : getTime(),
}
I want to display content using a flat relational data structure (similar to that of Firefeed). Everything is working the way it should, except I can't figure out how to display the actual content. I'm struggling for a while now and I think I'm almost there actually, but something is still missing.
I have two references:
var userFeedRef = new Firebase(FIREBASE_URL).child("users").child($rootScope.currentUser.$id).child("feed");
var uploadsRef = new Firebase(FIREBASE_URL).child("uploads");
The JSON looks like this:
{
"uploads" : {
"-KGkxzQj0FM2CMAXo5Em" : {
"author" : "87a8b6c8-7f72-45c2-a8c5-bb93fe9d320d",
"date" : 1462184179564,
"name" : "Zizazorro",
"reasonUpload" : "Test",
"startSec" : 80,
"uploadTitle" : "Kid Ink - Promise (Audio) ft. Fetty Wap"
},
"-KGlCoD7kEa1k3DaAtlG" : {
"author" : "87a8b6c8-7f72-45c2-a8c5-bb93fe9d320d",
"date" : 1462188328130,
"name" : "Zizazorro",
"reasonUpload" : "Test2",
"startSec" : 80,
"uploadTitle" : "Kid Ink - Show Me ft. Chris Brown"
}
},
"users" : {
"87a8b6c8-7f72-45c2-a8c5-bb93fe9d320d" : {
"date" : 1459369248532,
"feed" : {
"-KGkxzQj0FM2CMAXo5Em" : true,
"-KGlCoD7kEa1k3DaAtlG" : true
},
"firstname" : "Bob",
"followers" : {
"e3de536b-03a1-4fb4-b637-ebcebaae55c6" : true
},
"following" : {
"e3de536b-03a1-4fb4-b637-ebcebaae55c6" : true
},
"regUser" : "87a8b6c8-7f72-45c2-a8c5-bb93fe9d320d",
"uploads" : {
"-KGkxzQj0FM2CMAXo5Em" : true,
"-KGlCoD7kEa1k3DaAtlG" : true
},
"username" : "Zizazorro"
},
"e3de536b-03a1-4fb4-b637-ebcebaae55c6" : {
"date" : 1459369285026,
"feed" : {
"-KGkxzQj0FM2CMAXo5Em" : true,
"-KGlCoD7kEa1k3DaAtlG" : true
},
"firstname" : "Anna",
"followers" : {
"87a8b6c8-7f72-45c2-a8c5-bb93fe9d320d" : true
},
"following" : {
"87a8b6c8-7f72-45c2-a8c5-bb93fe9d320d" : true
},
"regUser" : "e3de536b-03a1-4fb4-b637-ebcebaae55c6",
"username" : "Sven8k"
}
}
}
The problem is: How can I display the actual content of the upload, when there is only a ID reference? I need a reference to the IDs for a user (userFeedRef) and a reference to the actual content of those specific IDs, not all uploads (uploadsRef).
How can I display this user ng-repeat in my html? So for example: ng-repeat {{feed.reasonUpload}} for user1 has to show:
Test
Test2
EDIT I've looked at this example, but I can't figure out how to render the content on the actual html feed in my case
var commentsRef =
new Firebase("https://awesome.firebaseio-demo.com/comments");
var linkRef =
new Firebase("https://awesome.firebaseio-demo.com/links");
var linkCommentsRef = linkRef.child(LINK_ID).child("comments");
linkCommentsRef.on("child_added", function(snap) {
commentsRef.child(snap.key()).once("value", function() {
// Render the comment on the link page.
));
});
You can do something like this:
$scope.finalData = (Object).values($scope.firebaseData.uploads);
//$scope.firebaseData is data what you retrieving from firebase.
Hope this plunker will help you.
I was trying to set start time using xdsoft dateTimePicker. I just want to see 00:00 time when I open picker at first time, but I've got a current time. As documentation says, all I have to do is set startTime : "my time", but I have no effect. Also example of startDate doesn't work.
My code:
<script type="text/javascript">
jQuery(
"#<c:out value="${requestItem.fieldNumber}"/>")
.datetimepicker(
{
lang : 'ru',
i18n : {
ru : {
months : [
'Январь',
'Февраль',
'Март',
'Апрель',
'Май',
'Июнь',
'Июль',
'Август',
'Сентябрь',
'Октябрь',
'Ноябрь',
'Декабрь', ],
dayOfWeek : [
"Вс",
"Пн",
"Вт",
"Ср",
"Чт",
"Пт",
"Сб", ]
}
},
startDate:'1987/12/03',
dayOfWeekStart : 1,
timepicker : true,
format : 'd.m.Y H:i'
});
</script>
jQuery('#datetimepicker2').datetimepicker({
datepicker:false,
format:'H:i',
defaultTime:'00:00'
});
I'm using Fullcalendar integrated with jQuery Mobile. When I tried to add new events dynamically using following method during pageshow event it causes a JavaScript exeption as below
Uncaught TypeError: Cannot call method 'empty' of undefined
My JavaScript Code
$('#myCalendar').live('pageshow',function(event){
Newevents = [
{
title : 'event1',
start : '2012-11-24 01:00',
color:'red'
},
{
title : 'event2',
start : '2012-11-25',
end : '2012-11-27'
},
{
title : 'event3',
start : '2012-11-28 12:30:00',
allDay : false // will make the time show
},
{
title : 'event4',
start : '2012-11-29 01:30:00',
allDay : false // will make the time show
}
];
$('#calendar').fullCalendar('renderEvent',Newevents);
$('#calendar').fullCalendar('rerenderEvents');
});
$('#myCalendar').live('pagecreate',function(event){
$('#calendar').fullCalendar({
// put your options and callbacks here
header: {
left: '',
center: '',
right: ''
},
firstDay :1,
viewDisplay: function(view) {
$('#calendarLabel').html(view.title);
},
events:[
{
title : 'event1',
start : '2012-11-21 01:00',
end:'2012-11-24 02:00',
color:'red'
},
{
title : 'event2',
start : '2012-11-05',
end : '2012-11-07'
},
{
title : 'event3',
start : '2012-11-09 12:30:00',
allDay : false // will make the time show
},
{
title : 'event4',
start : '2012-11-09 01:30:00',
allDay : false // will make the time show
}
],
eventClick: function(calEvent, jsEvent, view) {
alert('Event: ' + calEvent.title);
},
dayClick: myDayClick,
height: 999999999
});
});
Rather than
.fullcalendar( 'renderEvent', []);
and
.fullCalendar( 'rerenderEvents');
Have you tried ... ?
.fullCalendar( 'addEventSource', NewEvents );
Like others I'm having problems getting timed events to show up on the agendaWeek view. If you look at the events below, the first two are mine and show up as all day events. The last one is from the documentation and shows up in the correct time block. I've been staring at this so long I'm sure I'm missing something simple. Can anyone else see it?
$(document).ready(function() {
$("#calendar").fullCalendar({
defaultView: 'agendaWeek',
month:0,//current year assumed, first day of month assumed
date: 4,
height: 650,
header: {left: 'title',center:'agendaWeek'},
events: [
{
title : 'Fred',
start : '2010-01-04 08:00:00',
end : '2010-01-04 09:00:00',
allday : false
},
{
title : 'Betty',
start : '2010-01-06 08:00:00',
allday : false
},
{
title : 'event3',
start : '2010-01-05 12:30:00',
allDay : false // will make the time show
}
]
});
});
</script>
I fixed my problem as follows: Where you have allday you need allDay with a capital D.
Cheers!