-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to use Nayjest/Grids without a database call and also add methods to allow for hiding and showing columns based on screen size #118
base: master
Are you sure you want to change the base?
Conversation
The tests are failing because it needs to be installed in a laravel application and the style checks seem to be not passing, but a quick look shows that it was also the case for all other pull requests so let me know if that's an issue. |
Hi Andrew, Also, I already have ArrayDataProvider in presentation/framework. Regarding hideXs / hideSm -- I can't merge it becouse generally grids was designed to work without twitter bootstrap too. I think, this is case when better to leave it for customizations outside main repository. Regarding tests with Laravel, see how it's done here: https://github.com/presentation-framework/laravel/tree/master/tests there is "laravel/framework" dev-dependency & specific bootstrap for tests (it's a draft, some code may be not working). And for future, please, create separate pull-requests for different features, becouse if maintainer refuse one feature, it's not possible to merge another features from samerequest. Pull request must contain no code align / ident changes for code not related to new features. |
Thanks for the information about Laravel tests. I couldn't find any information on how to properly create them except for this [https://websanova.com/blog/laravel/creating-a-new-package-in-laravel-5-part-5-unit-testing] which seemed very clunky. You mention an "ArrayDataProvider" but the reason I wrote the code for the "CollectionDataProvider" class is because I couldn't find anything related to this in the codebase. There is an "ArrayDataRow" but no ArrayDataProvider. Is it possible it disappeared after a pull request or something? As for the hideXs, Sm, etc, it actually does not require bootstrap, it simply adds the hidden-* class to each column header and data row. If you are not using bootstrap you would simply have to add this css manually but I can understand why you would not want this. What if I modified this function to add "style" attributes instead? Edit: I just did some research and you cannot inline media queries. Today I learned. The same functionality could be created by adding a simple CSS file, which would still fulfill the requirement of working without Twitter Bootstrap |
I'm looking for a simple PHP Array data provider so I'm trying out this one. While testing I came across the following issue: On https://github.com/Nayjest/Grids/blob/master/src/Components/ShowingRecords.php#L38 it will call |
Thanks for making this package it's been very helpful.
I wanted to be able to use the table builder function without making an additional database call as the data already exists in my application and a second call is redundant.
I created a new DataProvider called CollectionDataProvider that accepts an Illuminate\Database\Eloquent\Collection object instead of a query.
The code itself is essentially copied from EloquentDataProvider so it shouldn't be too hard to understand.
Sorting is a bit weird with this Collection as it seems to be done via the query, but this wasn't a problem for me since my data was already pre sorted to begin with.
I also added some tests for the CollectionDataProvider, though there weren't any examples to work off of so they are quite basic. Essentially they just check to make sure no methods throw an error
I also added the ability to hide columns based on screen size. This method simply adds the bootstrap class hidden-* to both the header and the row column items when building the table. Here is an example of how to use it