Hello Felgo!
I have my calendarListModel: [] which I pull from Firebase, now I am having issues creating the events list on the currently selected date in the calendar;
I either have the entire modelData, or nothing, the result I am looking for would be, for example. That if there are 3 events in the database under the date of 22-2-2019, they will only show in the eventListview when that date is selected, but not any events for other dates stored.
When I read the data from firebase I push It into an array, code below.
//after read from Firebase, data is pushed into calendarListModel: [] in my main.qml
for(var i in value)
calendarListModel.push({date: new Date(value[i].date).getTime(), status: value[i].status, name: value[i].name, details: value[i].details})
ListView {
id:eventListView
model: calendarListModel
delegate: Rectangle {
Rectangle {
width: parent.width
Column {
id: eventItemColumn
Label {
id: nameLabel
text: modelData.name
}
Label {
id: detailsLabel
text: modelData.details
}
}
}
}
}
I have tried a number of things such as (and a hell of a lot of variations of the below);
model: calendarListModel.date(calendar.SelectedDate)
model:
{
for (calendar.selectedDate ; calendarListModel.date === calendar.selectedDate; ) {
model.append({name: calendarListModel.name, details: calendarListModel.details})
}
}
model: {
if (calendar.selectedDate === calendarListModel.date) {
modelData = ({name: calendarListModel.name, details: calendarListModel.details})
}
else {
}
}
model: { var eventModel = calendarListModel.find( function(obj) { return obj.date === calendar.selectedDate; } ); if (eventModel === undefined) {eventModel.clear()} else { eventModel.append(calendarListModel) } }
calendar.selectedDate(calendarListModel.indexOf(styleData.date.getTime()) > -1)
After exhausting options I can think of, and trawling the web, someonehelp!
Thanks in advance for any advice!
E