Download the PHP package fazzinipierluigi/laraexpress_datasource without Composer
On this page you can find all versions of the php package fazzinipierluigi/laraexpress_datasource. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fazzinipierluigi/laraexpress_datasource
More information about fazzinipierluigi/laraexpress_datasource
Files in fazzinipierluigi/laraexpress_datasource
Package laraexpress_datasource
Short Description A laravel library that generates a data source for DevExpress frontend libraries
License GPL-3.0-or-later
Informations about the package laraexpress_datasource
LaraExpress Datasource
This library provides a helper for generating datasources for widgets in the DevExpress javascript library.
Advancement
- [ ] Load
- [x] Filters
- [x] Sorting
- [x] Pagination
- [x] Grouping
- [ ] Insert
- [ ] Update
- [ ] Delete
Usage
Inside the method in your controller:
You can pass the frontend timezone to the constructor (the default is 'Euurope/Rome'), alternatively you can set it later with the setTimezone method
In the frontend we first include the library for the data store (go to documentation), in my case:
<script src="https://unpkg.com/devextreme-aspnet-data/js/dx.aspnet.data.js"></script>
after that:
The apply method accepts a third optional parameter, namely "field_map", this parameter is used to map the database fields in case fields are renamed in the generation of the response or if more than one database column corresponds to a datagrid column:
The "apply" method also accepts an optional fourth parameter; this is used to override the sorting behavior:
In this case if we had passed only the "field_map" array to apply the sorting would have been done based on the customer id, instead by overriding it we can force the sorting by company name while still maintaining the search by id.