Code Monkey home page Code Monkey logo

grids's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grids's Issues

Update to use laravelcollective/html

FYI, "illuminate/html" should be replaced with "laravelcollective/html" as the former is no longer supported and the latter contains additional methods too (such as a numeric field etc.)

"require": {
    "nayjest/grids": "~0.8",
    "illuminate/html": "~5"
},


"require": {
    "nayjest/grids": "~0.8",
    "laravelcollective/html": "~5.0"
},

More information can be found here...

Filtering with SetCallback

Hey Man,
i've some troubles filtering a column of the grid with my data, and i was wondering if you could help me or tell me that what i'm doing is wrong :)

So my dataset is a join between client and invoices.

On a column of my grid i display the client who own the invoice. So in the setCallBack method i use the client_id in the invoice to retreive is name :
->setCallback(function ($val) {
$client_intitule = DB::select("SELECT clients_raison_sociale FROM tri_clients WHERE clients_id = ?",array($val));
foreach($client_intitule as $ci){
$clients_raison_sociale = $ci->clients_raison_sociale;
}
return $clients_raison_sociale;
})
This is working fine :)
But now i want to add a filter on the name of the client but i have only the id of the client in my dataset so i can only filter on his id.

I read somewhere about the "setFilteringFunc" and i tried something like:
->setFilteringFunc(function($val, EloquentDataProvider $provider) {
$builder = $provider->getBuilder();
echo $val;
$builder->where('tri_clients.clients_raison_sociale', 'like', "$val");
})

But i can't get it working, but the $val in filteringFunc is the filter input of the user.
Do you have any idea what i'm doing wrong ?

Taggable functionality isn't utilized

  • First of all, looks like there is no possibility of recursive components search by tag name
  • What is strong reasons to maintain mensioned functionality? Use cases?

Eager Loading is not working

I am using an eager loaded query builder and yet I can see that my relations are still getting queried for each row...

$grid = new Grid(
(new GridConfig)
->setDataProvider(
new EloquentDataProvider(Customer::with('Country'))
)
->setName('Customers')
->setPageSize(50)
->setColumns([

                (new FieldConfig)
                    ->setName('country.name')
                    ->setLabel('Country')
                    ->setSortable(true)

....

SelectFilter

Hi , is there option in SelectFilter for ading id on each select filter ????

I have this:
(new SelectFilter)
->setDefaultValue('g_name')
->setName('Group Name')
->setVariants([$group_name])
->setFilteringFunc(
(function($val, EloquentDataProvider $dp) {
/** @var Illuminate\Database\Eloquent\Builder $builder */
$builder = $dp->getBuilder();
$builder->where('group.id', 'like', $val);
//dd($builder);
})
)

But i also i have more so i want to identify each of them to be different ???

Tutorial

A full tutorial (or documentation) for a crud using Grids would be wonderful for a beginner.

CsvExport Component doesn't work correctly

if i use csv export component, the start from the document included in csv file.

$grid = new Grid(
        (new GridConfig)
   ..... some fields ....
->setComponents([

            (new THead)

            ,
            (new TFoot)
                ->addComponent(
                    (new CsvExport)
                 )
     ])

Export starts with

<section class="main-content">
<div class="container-fluid">

        <div class="panel panel-default">
            <div class="panel-heading lead">Grid-Header</div>
            <div class="panel-body">
                                    <div class="table-responsive">

Overwrite pager path

Hey men, firstable awesome work here, thanks a lot.

Do you know if it's possible to overwrite the path of the grid pager in the grid declaration (in controllers) ?

I need to overwrite it and i changed in Pager :
$paginator = $this->grid->getConfig()
->getDataProvider()
->getPaginator();
$paginator->setPath("/extranet/public/client");
Is it possible to use something like :
(new OneCellRow)
->setComponents([
(new Pager)
->setPath('/extranet/public')
]).

Thanks a lot for what you've done and sorry if my question is in the wrong place.

Louis

providers and aliases

Class 'Grid' not found !!
would you please tell me the 'providers' and 'aliases' to put in app.php file?

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR)

Method Nayjest\Grids\Grid::__toString() must not throw an exception
getting this error if i set each file in the aliases array

Change OneCellRow implementation

  1. Use TR tag with TD as default child component, override setComponents & getComponents & render methods(to use parent::getComponents)

Redirect to valid page number if requested page has no items.

E.g user 1 is on page 4 of 5 available.
user 2 delete all items on page 4 and 5.
user 1 try to navigate to page 5 and get empty page.

It would be better if user were redirected to last available page.

My workaround is using laravel pagination before initialize grid.
Is there any better way to solve this problem?

$contracts = Contract::paginate(10);
$currPage = \Illuminate\Support\Facades\Request::get('contract')['page'];

if ((int)$currPage > $contracts->lastPage()){
    $url = action('ContractController@index', ['contract' => ['page' => $contracts->lastPage()]]);
    return redirect($url);
}

$grid = new Grid(
    (new GridConfig)
    ...

Record counts

How do i show following output in footer or header?
"Showing 1-50 of 10000"
possible?

Customizing blades

How can i customise blades?

I have tried to update published blades from app/resources/views/nayjest/grids/default/*, but still get output from vendor directory (app/vendor/nayjest/grids/resources/views)

Don't create Grids class alias, confuses phpspec

There is no need for class_alias('\\Nayjest\\Grids\\Grids', '\\Grids'); in the Grids ServiceProvider. It is confusing phpspec with the error below.

If a regular Laravel class alias is added, I don't see this problem:

\Illuminate\Foundation\AliasLoader::getInstance(['Grids' => 'Nayjest\Grids\Grids'])->register();

This can also be put in the config/app.php file as well to give developers more control.

[ErrorException]: Cannot redeclare class \Grids  

Exception trace:
 () at vendor/nayjest/grids/src/ServiceProvider.php:45
 Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a
 class_alias() at vendor/nayjest/grids/src/ServiceProvider.php:45
 Nayjest\Grids\ServiceProvider->boot() at n/a:n/a
 call_user_func_array() at vendor/laravel/framework/src/Illuminate/Container/Container.php:523
 Illuminate\Container\Container->call() at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:703
 Illuminate\Foundation\Application->bootProvider() at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:685
 Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() at n/a:n/a
 array_walk() at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:686
 Illuminate\Foundation\Application->boot() at vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:15
 Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() at vendor/laravel/framework/src/Illuminate/Foundation/Application.php:181
 Illuminate\Foundation\Application->bootstrapWith() at vendor/benconstable/phpspec-laravel/src/PhpSpec/Laravel/Util/Laravel.php:100
 PhpSpec\Laravel\Util\Laravel->createApplication() at vendor/benconstable/phpspec-laravel/src/PhpSpec/Laravel/Util/Laravel.php:59
 PhpSpec\Laravel\Util\Laravel->refreshApplication() at vendor/benconstable/phpspec-laravel/src/PhpSpec/Laravel/Listener/LaravelListener.php:54
 PhpSpec\Laravel\Listener\LaravelListener->beforeSpecification() at n/a:n/a
 call_user_func() at vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164
 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at vendor/phpspec/phpspec/src/PhpSpec/Runner/SpecificationRunner.php:51
 PhpSpec\Runner\SpecificationRunner->run() at vendor/phpspec/phpspec/src/PhpSpec/Runner/SuiteRunner.php:56
 PhpSpec\Runner\SuiteRunner->run() at vendor/phpspec/phpspec/src/PhpSpec/Console/Command/RunCommand.php:149
 PhpSpec\Console\Command\RunCommand->execute() at vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at vendor/symfony/console/Symfony/Component/Console/Application.php:882
 Symfony\Component\Console\Application->doRunCommand() at vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at vendor/phpspec/phpspec/src/PhpSpec/Console/Application.php:85
 PhpSpec\Console\Application->doRun() at vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at vendor/phpspec/phpspec/bin/phpspec:26

Access on checkbox from outside of the grid

Hey men, me again :)

Is it possible to access to my column of checkboxes with a all check, all un check and print ids buttons of raw checked by the user ?

Really appreciate some help.

Have a nice day,
Louis.

Can't filter on joined Tables

If i join tables, the initial output is ok. But if i wan't to add a filter, there comes the error message, that column can't be found or there more than one column with the same name (i.e. name). It looks like the filterin doesn't use the select fields.

Data Provider:

$query = new EloquentDataProvider(
        Contract::join('products', 'products.id', '=', 'contracts.product_id')
                ->join('vendors', 'vendors.id', '=', 'products.vendor_id')
                ->select('contracts.id',
                    'vendors.name as vendor_name',                        
                )
    );

Grid Initialization:

$grid = new Grid(
        (new GridConfig)
            ->setName('filter')
            ->setDataProvider($query)
            ->setColumns([
                (new FieldConfig)
                    ->setName('id')
                    ->setLabel('#')
                ,

                (new FieldConfig)
                    ->setName('vendor_name')
                    ->setLabel('Vendor')
                    ->addFilter(
                        (new FilterConfig)
                            ->setName('vendor_name')
                            ->setOperator(FilterConfig::OPERATOR_LIKE)
                    )                    
        ])

    );

Error message:

Column not found: 1054 Unknown column 'vendor_name' in 'where clause' (SQL: select count(*) as aggregate from `contracts` inner join `products` on `products`.`id` = `contracts`.`product_id`  inner join `vendors` on `vendors`.`id` = `products`.`vendor_id` where `vendor_name` like %Test%)

DBAL example

Can you pls post an example of grid with DBAL source?
Tried but got an error on laravel 5. thanks
FatalErrorException in DbalDataProvider.php line 72: Call to undefined method Illuminate\Pagination\Paginator::make()

Bulk actions

Is it possible to implement bulk actions? I want to delete multiple rows. I need checkboxes in front of every row and delete selected rows. How could I implement this?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.