Support Forum
autoSync performs a request only after autoSyncTimeout is over. So it grabs all changes and send them together. If records are still dirty after sync request is completed, please make sure your server response is correct. if "success" not equal to "true", request is considered to be failed.
Pavlo Miklashevych
Sr. Frontend Developer
I'm sure "success" equal to "true".But after 'autoSync', the last synchronized data will be sent to the background together with the latest data. Is there any way to just send the latest data?
crudManager : {
autoLoad : true,
autoSync : true,
autoSyncTimeout : 100,
transport : {
load: {
url : conf.schedulerLoad
},
sync : {
url : conf.schedulerSync,
method : 'POST',
paramName : 'dat',
params : {
taskId : 1
}
}
},
writeAllFields: true
}
Hello,
While was checking your issue I found a bug that writeAllFields on crudManager doesn't work. Need to set writeAllFields to stores explicitly. Ticket here: https://app.assembla.com/spaces/bryntum/tickets/9094-crudmanager-writeallfields-is-not-taken-into-account/details
Other than that I don't see any issues and I can't reproduce yours. Please adjust examples/crudmanager/app.js
Then go to the browser, drag "Serve engine" one hour ahead, then drag "Paint job" one hour ahead. See 2 sync requests in console. Each request has only one item (events.updated[0]).
Please let me know how to adjust the demo and what to do to see 2 items in the second request. Or provide a runnable testcase which shows the issue.
Best,
Pavel
While was checking your issue I found a bug that writeAllFields on crudManager doesn't work. Need to set writeAllFields to stores explicitly. Ticket here: https://app.assembla.com/spaces/bryntum/tickets/9094-crudmanager-writeallfields-is-not-taken-into-account/details
Other than that I don't see any issues and I can't reproduce yours. Please adjust examples/crudmanager/app.js
crudManager : {
// writeAllFields : true, // Doesn't work, see https://app.assembla.com/spaces/bryntum/tickets/9094
resourceStore : {
writeAllFields : true,
// Add some custom fields
fields : ['car', 'dt']
},
eventStore : {
writeAllFields : true,
// Add a custom field and redefine durationUnit to default to hours
fields : ['dt', { name : 'durationUnit', defaultValue : 'hour' }]
},
....
autoLoad : true, // already true in this demo
autoSync : true, // already true in this demo, timeout is 100 by default
Please let me know how to adjust the demo and what to do to see 2 items in the second request. Or provide a runnable testcase which shows the issue.
Best,
Pavel
Pavlo Miklashevych
Sr. Frontend Developer
Hello:
https://lh/scheduler/examples/crudmanager/
This link cannot be opened
Here is my example:
App.tsx
NewScheduler.tsx
The demo in PHP returns the CRUD changes data. Does 'autoSync' return the changes data?
If so, what is the return data structure?
Thanks !
https://lh/scheduler/examples/crudmanager/
This link cannot be opened
Here is my example:
App.tsx
import * as React from 'react';
import NewScheduler from './newScheduler';
class App extends React.Component {
// public state = {
// jsPan: undefined,
// gantt: undefined,
// };
public componentDidMount() {
console.log('start App.')
}
public render() {
const marginBottomTop10 = {
marginBottom: '10px',
marginTop: '10px'
};
const ele = (
<div className="x_content">
<div className="row" style={marginBottomTop10}>
<div className="col-md-12 col-sm-12 col-xs-12">
<NewScheduler />
</div>
</div>
</div>
);
return ele;
}
}
export default App;
import * as React from 'react';
import 'bryntum-scheduler/scheduler.stockholm.css'
import {Scheduler, TimeSpan} from 'bryntum-scheduler';
class NewScheduler extends React.Component {
public state = {
timeRanges : null
};
public scheduler: any = null;
public componentDidMount() {
this.scheduler = new Scheduler({
appendTo : 'newscheduler',
minHeight : '20em',
eventStyle : 'border',
barMargin : 2,
autoHeight : true,
startDate : new Date(2019, 7, 7, 6),
endDate : new Date(2019, 7, 7, 20),
viewPreset : 'hourAndDay',
timeRanges : {
store: {
modelClass: TimeSpan,
storeId: 'timeRanges',
data: this.state.timeRanges
}
},
columns : [
{
// type : 'resourceInfo',
// imagePath : '../_shared/images/users/',
text : 'Staff',
field : 'name'
},
{
text : 'Type',
field : 'role',
flex : 1,
editor : {
type : 'combo',
items : ['Sales', 'Manager'],
editable : false,
pickerWidth : 140
}
}
],
crudManager : {
autoLoad : true,
autoSync : true,
autoSyncTimeout : 100,
transport : {
load: {
// url : '/data.json'
url : url_scheduler_load
},
sync: {
url : url_scheduler_sync,
method: 'POST',
paramName: 'data',
params : {
taskId : 1
}
}
}
},
features : {
contextMenu: {
cellItems: [{
text: 'Add rows',
icon: 'b-fa b-fa-plus',
weight: 140,
onItem: () => {
this.scheduler.resourceStore.add({name: 'New name', role: 'New'});
}
}]
}
},
});
}
public componentWillUnmount() {
this.scheduler.destroy();
}
public render() {
return <div className={'b-react-scheduler-container'} id='newscheduler' />
}
}
export default NewScheduler;
If so, what is the return data structure?
Thanks !
"lh" is localhost. "scheduler" is your distributive. "examples/crudmanager" is a path to the demo. The url can be differ depending on your local webserver configuration. The idea is to run demo locally, adjust sources and make sure it works.https://lh/scheduler/examples/crudmanager/
This link cannot be opened
Please see response format in our Gantt guides: https://www.bryntum.com/docs/gantt/#guides/crud_manager.mdThe demo in PHP returns the CRUD changes data. Does 'autoSync' return the changes data?
If so, what is the return data structure?
We will move it to scheduler in next releases.
The main idea is to return `true` in case of successful saving. Otherwise data will stay dirty and will be sent with next sync request.
{
"success" : true,
....
}
We accept only runnable testcases. If you want us to inspect your code, please make sure it's runnable, zip it up and attach here (node_modules should be removed, we have to be able to build and run it on our end).Here is my example
Best regards,
Pavel
Pavlo Miklashevych
Sr. Frontend Developer
Hello,
I think I've found the answer to the question.It's a matter of returning data structures.This article plays a very important role.
https://www.bryntum.com/docs/gantt/#guides/crud_manager.md
In addition, if a newly created resource must be 'resourceId' instead of 'id', it cannot be modified and deleted. Adding an event will result in an error.
Response:
Thanks again!
Best
William
I think I've found the answer to the question.It's a matter of returning data structures.This article plays a very important role.
https://www.bryntum.com/docs/gantt/#guides/crud_manager.md
In addition, if a newly created resource must be 'resourceId' instead of 'id', it cannot be modified and deleted. Adding an event will result in an error.
Response:
{
'success': true,
'requestId': '1122',
'revision': 2,
'events': {
'rows': [
{
'$PhantomId' : ‘3344’,
// To add a new event, you must use 'id' instead of 'eventId'.
'id' : 3,
'resourceId' : 4,
'name' : ‘test’,
'startDate' : '2019-08-22 10:00',
'endDate' : '2019-08-22 12:00',
...
}
],
'removed': []
},
'resources': {
'rows': [
{
'$PhantomId' : ‘5566’,
// To add a new resource, you must use 'resourceId' instead of 'id'.
'resourceId' : 5,
'name' : 'Jack',
...
}
],
'removed': []
}
}
Best
William
- Attachments
-
- 1.png (35.74 KiB) Viewed 2258 times
It doesn't sound right. Resource model idField is "id" by default. You can add a new resource in our CrudManager demo and see the response. Please run in console:// To add a new resource, you must use 'resourceId' instead of 'id'
scheduler.resourceStore.add({ car : 'ZAZ 968M' })
Please provide detailed steps of how I can reproduce the error with one of our samples.Adding an event will result in an error
Pavlo Miklashevych
Sr. Frontend Developer
I don't see any of these errors in this demo.
https://www.bryntum.com/examples/scheduler/crudmanager/
But the above error occurred in my example.I'm sure the 'id' will get an error, and I haven't changed anything about it.Does the following code matter?
https://www.bryntum.com/examples/scheduler/crudmanager/
But the above error occurred in my example.I'm sure the 'id' will get an error, and I haven't changed anything about it.Does the following code matter?
{ text : 'Id', field : 'id', width : 100, editor : false, hidden : false}