Premium support for our pure JavaScript UI components
Hi,
I'm trying to use scheduler (basic example) 4.1.4 locally to add to the store after a request but it does not update the store. I've tried
and
scheduler.eventStore.insert
. Should I use another store, use another function or what could it be?
The data I'm sending back includes all parameters you have in the initial state:
{
id : 1,
resourceId : 'r1',
startDate : new Date(2017, 0, 1, 10),
endDate : new Date(2017, 0, 1, 12),
name : 'Click me',
iconCls : 'b-fa b-fa-mouse-pointer'
}
Seems to work fine for me at https://bryntum.com/examples/scheduler/basic/
scheduler.eventStore.add({
id : 11,
resourceId : 'r1',
startDate : scheduler.startDate,
endDate : scheduler.endDate,
name : 'Click me',
iconCls : 'b-fa b-fa-mouse-pointer'
})
Could you try to reproduce in our samples and share the magic steps so we can repro it?
Here is my code (that does not work in your example):
let i = 8;
let _leadingZero = (int) => {
var str;
if (int === 0) {
int = int + 1;
}
str = int.toString();
if (str.length === 1) {
return '0' + str;
}
return str;
};
const scheduler = new Scheduler({
appendTo : 'container',
minHeight : '20em',
resources : resources,
events : events,
startDate : new Date(2017, 0, 1, 6),
endDate : new Date(2017, 0, 1, 20),
viewPreset : 'hourAndDay',
rowHeight : 50,
barMargin : 5,
multiEventSelect : true,
eventRenderer: record => {
console.log('eventRenderer', record);
return record.eventRecord.data.name;
},
columns : [
{ text : 'Name', field : 'name', width : 130 }
],
listeners: {
scheduleClick: record => {
fetch('app.config.json')
.then(response => response.json())
.then(response => {
let start = record.date,
year = start.getFullYear(),
month = _leadingZero(start.getMonth()),
day = _leadingZero(start.getDate()),
hour = _leadingZero(start.getHours() + 1),
minute = _leadingZero(start.getMinutes()),
end = `${year}-${month}-${day} ${hour}:${minute}`;
i++;
if (typeof response === 'string') {
response = JSON.parse(response);
}
response.id = i;
response.recourceId = record.resourceRecord.data.id;
response.startDate = record.date;
response.endDate = new Date(end);
response.name = `${record.resourceRecord.data.name} ${i}`;
response.parentIndex = parseInt(record.resourceRecord.data.id.replace('r', ''));
scheduler.eventStore.add(response);
});
},
},
});
Typo:
response.recourceId = record.resourceRecord.data.id;
resourceId