The data grid appears capable of a lot by looking at other examples, but the very simple example on the Aurelia section of the site really doesn't put together a fully featured example. Here's what I'm try to do but having trouble finding examples that work:
- have the grid call a REST Api for data with paging, sort, and filter arguments.
- have the grid call the REST Api cross-domain.
- have the grid call the REST Api including parameters from the page.
Below is an attempt I made using various documentation references, but it doesn't work. I'll include it as an example of what I want to accomplish.
The site is hosted at http://localhost:58000.
In page.ts:
export class page {
public searchText;
public searchResults;
public page =0;
public submit() {
this.searchResults = new ej.DataManager({
url: 'http://localhost:58700/api/values/find',
crossDomain: true,
adaptor: new ej.UrlAdaptor()
})
.executeQuery(new ej.Query().addParams("searchText", this.searchText));
return true;
}
}
In page.html:
<ej-grid e-data-source.bind="searchResults" e-page-settings.bind="page" e-allow-paging=true>
<ej-column e-field="id"></ej-column>
<ej-column e-field="firstName"></ej-column>
<ej-column e-field="lastName"></ej-column>
</ej-grid>
The first problem is this error, which seems like the crossDomain=true argument is ignored:
"XMLHttpRequest cannot load http://localhost:58700/api/values/find. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:58000' is therefore not allowed access."
Help getting this to work is appreciated.