The Grid React component inside components folder from the above example doesn't use CrudManager. the code looks like below:
/**
* @author Saki
* @date 2019-03-08 09:19:25
* @Last Modified by: Saki
* @Last Modified time: 2019-03-08 10:31:00
*
* Grid with unplanned tasks. This is just a react wrapper.
*/
// libraries
import React, { Component } from 'react';
// our stuff
import UnplannedGrid from '../lib/UnplannedGrid.js';
import Task from '../lib/Task.js';
class Grid extends Component {
componentDidMount() {
this.unplannedGrid = new UnplannedGrid({
appendTo : 'unplannedContainer',
eventStore : this.props.eventStore,
store: {
modelClass: Task,
autoLoad: true,
readUrl: 'https://127.0.0.1:8081/rest/',
fetchOptions: {
method: 'POST',
body: 'something'
},
headers: {
'Content-Type': 'application/json'
}
}
});
} // eo function componentDidMount
render() {
return (<div id="unplannedContainer"></div>);
} // eo function render
}; // eo class Grid
export default Grid;
// eof
Re: How to use fetchOptions with headers for populating data into eventStore?
Posted: Wed May 15, 2019 3:54 pm
by mats
You'll create a (slight) race condition by doing it the way you do, loading of event is done by CrudManager. Look at the sources, try listening instead on the CrudManager:
Only problem is that I cannot add data inside normalizedData variable to the eventStore from the response. Do you know anything about it ?
Re: How to use fetchOptions with headers for populating data into eventStore?
Posted: Wed May 15, 2019 10:28 pm
by mats
Not really following here. You're loading the unplanned Grid data but want to load it into the eventStore? `eventStore.add` is a method, so you can't do