|
export class FetchEmployee extends React.Component<RouteComponentProps<{}>, FetchEmployeeDataState> {
constructor(props) {
super(props);
}
public onload(args: any) {
(DataManager.prototype as any).makeRequest = function (url: any, deffered: Deferred, args?: any, query?: any): any {
. . . . . . . .
. . . . . . . .
let req: Object = (this as any).extendRequest(url, fnSuccess, fnFail);
let ajax: Ajax = new Ajax(req);
let getInstance: any = this;
ajax.beforeSend = () => {
(this as any).beforeSend(ajax.httpRequest, ajax);
};
let customajax: Ajax = new Ajax();
customajax.type = 'POST';
(customajax as any).contentType = 'application/json';
customajax.url = '/Home/Data';
customajax.data = JSON.stringify({ gid: [{ OrderID: 1009, CustomerID: "Raja", ShipCity: "India" }] });
customajax.send().then(function (value: any) {
debugger;
req = ajax.send();
(req as any).catch((e: Error) => true); // to handle failure remote requests.
(getInstance as any).requests.push(ajax);
});
. . . . . . . .
. . . . . . . .
}
let dm: any = new DataManager({
url: 'api/Orders',
adaptor: new WebApiAdaptor
});
(this as any).grid.dataSource = dm;
}
public render() {
return (<div className='control-section'>
<GridComponent ref={g => (this as any).grid = g} allowPaging={true} height={340} load={this.onload.bind(this)} >
<ColumnsDirective>
<ColumnDirective field='OrderID' headerText='Order ID' width='125' textAlign='Right' />
<ColumnDirective field='ShipCity' headerText='ShipCity' width='125' />
</ColumnsDirective>
<Inject services={[Page]} />
</GridComponent>
</div>)
}
}
|