I have a SmartClientJS 13 application using a non-SmartClient server. I've created a data source instance to retrieve orders. It more or less has these properties:
SmartClient uses the HTTP POST method for all operation types.
When a single record is loaded, the data source sends a payload with a "data" object containing an "id" property (eg. { data: { id: 1 }}). My server checks this "data" property and if it contains an ID, it retrieves a single record, else a collection.
How can I make a request to retrieve a PDF file (eg. the invoice for an order)? Can I still use the data source or should I use RPCManager.sendRequest()? I've tried the latter but couldn't create the right "data" object. Ideally, I would like to change the dataURL to end with ".pdf" instead of ".json".
Hopefully my question makes sense. I've tried ChatGPT to find an answer but wasn't able to work it out.
Code:
{ dataFormat: 'json', dataURL: '/orders.json', disableQueuing: true, jsonPrefix: '', jsonSuffix: '', operationBindings: [ { dataProtocol: 'postMessage', operationType: 'fetch' }, { dataProtocol: 'postMessage', operationType: 'add' }, { dataProtocol: 'postMessage', operationType: 'update' }, { dataProtocol: 'postMessage', operationType: 'remove' } ] }
When a single record is loaded, the data source sends a payload with a "data" object containing an "id" property (eg. { data: { id: 1 }}). My server checks this "data" property and if it contains an ID, it retrieves a single record, else a collection.
How can I make a request to retrieve a PDF file (eg. the invoice for an order)? Can I still use the data source or should I use RPCManager.sendRequest()? I've tried the latter but couldn't create the right "data" object. Ideally, I would like to change the dataURL to end with ".pdf" instead of ".json".
Hopefully my question makes sense. I've tried ChatGPT to find an answer but wasn't able to work it out.
Comment