In Bryntum Scheduler Pro v6.0.0 is it possible to configure lazy loading loadUrl to use restful methods in the project level? I know that it's possible to configure in the eventStore and the resourceStore seperately but it doesn't seem to work on the ProjectModelConfig level.
When I replace project with CRUD Manger it runs into an error. Cannot read properties of undefined (reading '_isLoading')
{
appendTo : 'container',
viewPreset : 'dayAndMonth',
// To center the view on a certain date
visibleDate : new Date(2024, 1, 6),
// Enables endless timeline scrolling
infiniteScroll : true,
// The infiniteScroll gets a better UX if a larger bufferCoef is used. When using lazyLoading, this only means that
// the timeline "shifts" more seldom. Only events inside or close to the visible date range is requested from the
// backend
bufferCoef : 20,
// Affects when the timespan shifts upon horizontal scroll
bufferThreshold : 0.01,
// Current backend easily runs out of memory, this prevents the requested date ranges from being too long
minZoomLevel : 11,
tickSize : 30,
crudManager: {
loadUrl: 'php/read.php',
// This will activate the lazy load functionality
lazyLoad: true,
// This will initiate the first load upon creation
autoLoad: true,
},
features : {
// Grouping is not supported when using a lazyLoad store
group : false,
filter : false
},
columns : [
{
text : 'Resource',
field : 'name',
width : 200,
sortable : false,
filterable : false
}
],
tbar : [
{
type : 'viewpresetcombo'
},
'->',
{
type : 'button',
text : 'Reset data',
icon : 'b-fa b-fa-refresh',
ref : 'resetButton',
onClick({ source }) {
// In addition to clearing all records, this will also remove any lazy loading cache on these stores
scheduler.eventStore.data = [];
scheduler.assignmentStore.data = [];
scheduler.resourceStore.data = [];
fetch('php/reset.php').then(() => {
scheduler.project.load();
});
}
}
]
}
Hey marcio,
Thanks for the update. How do I enable lazy loading for only the eventStore and the resourceStore in this format? Couldn't figure out how to specify that in the ProjectModelConfig itself.
{
appendTo : 'container',
viewPreset : 'dayAndMonth',
// To center the view on a certain date
visibleDate : new Date(2024, 1, 6),
// Enables endless timeline scrolling
infiniteScroll : true,
// The infiniteScroll gets a better UX if a larger bufferCoef is used. When using lazyLoading, this only means that
// the timeline "shifts" more seldom. Only events inside or close to the visible date range is requested from the
// backend
bufferCoef : 20,
// Affects when the timespan shifts upon horizontal scroll
bufferThreshold : 0.01,
// Current backend easily runs out of memory, this prevents the requested date ranges from being too long
minZoomLevel : 11,
tickSize : 30,
project : {
autoLoad : true,
autoSync : true,
lazyLoad : true,
loadUrl : 'php/read.php',
syncUrl : 'php/sync.php',
phantomIdField : 'phantomId',
assignmentStore : {
syncDataOnLoad : false
},
resourceStore : {
syncDataOnLoad : false,
fields : [
{ name : 'calendar', persist : false },
{ name : 'maxUnit', persist : false },
{ name : 'parentId', persist : false }
]
},
eventStore : {
syncDataOnLoad : false,
fields : [
{ name : 'duration', persist : false },
{ name : 'effort', persist : false },
{ name : 'constraintDate', persist : false }
]
}
},
features : {
// Grouping is not supported when using a lazyLoad store
group : false,
filterBar : true
},
columns : [
{
text : 'Resource',
field : 'name',
width : 200,
sortable : false,
filterable : true
}
],
tbar : [
{
type : 'viewpresetcombo'
},
'->',
{
type : 'button',
text : 'Reset data',
icon : 'b-fa b-fa-refresh',
ref : 'resetButton',
onClick({ source }) {
// In addition to clearing all records, this will also remove any lazy loading cache on these stores
scheduler.eventStore.data = [];
scheduler.assignmentStore.data = [];
scheduler.resourceStore.data = [];
fetch('php/reset.php').then(() => {
scheduler.project.load();
});
}
}
]
}
{
appendTo: 'container',
viewPreset: 'dayAndMonth',
// To center the view on a certain date
visibleDate: new Date(2024, 1, 6),
// Enables endless timeline scrolling
infiniteScroll: true,
// The infiniteScroll gets a better UX if a larger bufferCoef is used. When using lazyLoading, this only means that
// the timeline "shifts" more seldom. Only events inside or close to the visible date range is requested from the
// backend
bufferCoef: 20,
// Affects when the timespan shifts upon horizontal scroll
bufferThreshold: 0.01,
// Current backend easily runs out of memory, this prevents the requested date ranges from being too long
minZoomLevel: 11,
tickSize: 30,
selectionMode: { rowNumber: true },
features: {
// Grouping is not supported when using a lazyLoad store
group: false,
filterBar: true,
resourceTimeRanges: true
},
columns: [
{
text : 'Name',
field : 'name',
width : 200,
editor : {
type : 'textfield',
required : true
}
},
],
resourceStore: {
lazyLoad: true,
// Uncomment these and comment out below to use the express.js backend
// readUrl : 'http://lh:3000/read-resources',
// createUrl : 'http://lh:3000/create-resources',
// deleteUrl : 'http://lh:3000/delete-resources',
// updateUrl : 'http://lh:3000/update-resources',
// Comment out these and uncomment above to use the express.js backend
readUrl: './php/resource/read.php',
createUrl: './php/resource/create.php',
deleteUrl: './php/resource/delete.php',
updateUrl: './php/resource/update.php',
autoLoad: true,
autoCommit: true,
sortParamName: 'sort',
filterParamName: 'filter'
},
eventStore: {
lazyLoad: true,
// Uncomment these and comment out below to use the express.js backend
// readUrl : 'http://localhost:3000/read-events',
// createUrl : 'http://localhost:3000/create-events',
// deleteUrl : 'http://localhost:3000/delete-events',
// updateUrl : 'http://localhost:3000/update-events',
// Comment out these and uncomment above to use the express.js backend
readUrl: './php/event/read.php',
createUrl: './php/event/create.php',
deleteUrl: './php/event/delete.php',
updateUrl: './php/event/update.php',
autoCommit: true,
fields: [{ name: 'duration', persist: false }]
},
resourceTimeRangeStore: {
lazyLoad: true,
// Uncomment this line and comment out below to use the express.js backend
// readUrl : 'http://lh:3000/read-resourcetimeranges'
readUrl: './php/resourcetimerange/read.php'
},
tbar: [
{
type: 'viewpresetcombo'
},
'->',
{
type: 'button',
text: 'Reset data',
icon: 'b-fa b-fa-refresh',
ref: 'resetButton',
onClick() {
// In addition to clearing all records, this will also remove any lazy loading cache on these stores
scheduler.resourceStore.data = null;
scheduler.eventStore.data = null;
scheduler.resourceTimeRangeStore.data = null;
// As the SchedulerResourceStore is an AjaxStore, calling load with a params object will include these parameters
// in the lazy load server request.
scheduler.resourceStore.load({ reset: true });
}
}
]
}