ofcold / nova-sortable Goto Github PK
View Code? Open in Web Editor NEWAdds sorting functionality to Laravel Nova's index resource
License: MIT License
Adds sorting functionality to Laravel Nova's index resource
License: MIT License
After implementing indexQuery thusly:
/**
* Build an "index" query for the given resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public static function indexQuery(NovaRequest $request, $query)
{
$query->when(empty($request->get('orderBy')), function (Builder $q) {
$q->getQuery()->orders = [];
return $q->orderBy('sort_order');
});
return $query;
}
I'm getting the following error whenever loading my resource's index page:
Argument 1 passed to App\Nova\FaqCategory::App\Nova{closure}() must be an instance of App\Nova\Builder, instance of Illuminate\Database\Eloquent\Builder given, called in /var/www/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php on line 91
Is this an issue with newer versions of Nova, or how can I fix this?
Is there any way to have a localized Toast messages instead of changing it in ResourceTable.vue?
this.$toasted.show(
this.__('The new order has been set!'),
{type: 'success'}
);
Hello,
Is there an option to disable sorting for HasMany relationships or not show sorting on the main index?
If not is there a way this could be achieved?
Cheers
Lovely package! My only complaint is that the page refreshes after sorting. I noticed other sort packages behave like this as well so I am not sure it is even possible to fix.
After installing this package, the Nova "Inline Action" does not refresh the List View page after the action is executed.
As soon as I remove this package, all works fine as expected. May I kindly ask to look into this?
Nice interface!
Would be great if you could make the package compatible with
https://github.com/spatie/eloquent-sortable
as used by
https://novapackages.com/packages/naxon/nova-field-sortable
@lilianjin I've already filed an issue with @davidhemphill over at /nova-issues, but I'm curious if you've found a workaround? I'm unable to affect ANY type of sorting on my index. No matter how I try to orderBy
the $query
, Nova sorts by ID by default. So I can rearrange the index sorting all I want using this package (which is great, BTW), but once I refresh the page the sort order (visually) reverts back to sorted by ID... any ideas?
Will it save 10000 sort orders each time drag drop?
When relations are paginated it acts really weird when sorting. Sorting the second page makes the items appear before the items on the first page.
This isn't too big of a problem as I just disable pagination in this case, but it would be cool if it would take into account the page it is on (if that's even possible).
I have a table with less than 100 records and the position column as NULL. When I sort any record, it updates the position of all records on that page, but the index starts at 11000. Is it the expected behaviour? Because, since the other records position are NULL, they are shown first after the page refresh.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.