Posted 7 July 2023, 10:15 am EST
Hi,
I want to use the DataManager.addTable to access my tables through a REST service.
But I need to add some values in the HTTP headers for security reason.
How can I do that?
Thanks
Forums Home / Spread / SpreadJS
Posted by: Fabrice.Mainguene on 7 July 2023, 10:15 am EST
Posted 7 July 2023, 10:15 am EST
Hi,
I want to use the DataManager.addTable to access my tables through a REST service.
But I need to add some values in the HTTP headers for security reason.
How can I do that?
Thanks
Posted 10 July 2023, 5:19 am EST
Hi,
You may define your own callback to request the server. Please refer to the following code sni[ppet and the attached demo that explains the same.
var myTable = dataManager.addTable("myTable", {
// ... other settings
autoSync: true // enable the autoSync mode
remote: {
read: function (): Promise<any[]>{
return requestToServer();
},
update: function (item): Promise<any>{ // the updated data change
return requestToServer(item);
},
create: function (item): Promise<any>{ // the created data change
return requestToServer(item);
},
delete: function (item): Promise<boolean>{ // the deleted data change
return requestToServer(item);
},
}
});
Regards,
Avinash