cakephp-datatable icon indicating copy to clipboard operation
cakephp-datatable copied to clipboard

Containable Not filtering

Open spacebiscuit opened this issue 9 years ago • 2 comments

I'm using the branch release that supposedly supports Containable.

When I search to filter my table doesn't crash but the rows do not filter so it seems there is a bug.

$this->paginate = [
        'contains' => ['Product'],
                'fields' => [
                    'Variation.id','Variation.sku','tVariation.stock_level',
                    'Product.title'
                ],
 ];

$this->DataTable->mDataProp = true;
$this->set('response', $this->DataTable->getResponse());
$this->set('_serialize','response');

spacebiscuit avatar Sep 21 '16 07:09 spacebiscuit

There likely is a bug. I stopped development on this nearly 2 years ago and have no plans to support it in the future. You are welcome to commit a fix or become project owner if you are actively using this plugin. I have hopes at my new job that I can port this over to Cake 3 within the next year as we reboot our CRM, but no promises.

cnizzardini avatar Sep 21 '16 15:09 cnizzardini

@spacebiscuit I don't see any issue with the plugin code for your issue. I did notice a problem in your code. Containable behavior must be used with key contain instead of contains in your code. Also, I put additional pagination settings into $this->Paginator->settings. So your code should be

$this->Paginator->settings = [
        'contain' => ['Product'],      // Note: "contain" - valid; "contains" - invalid
                'fields' => [
                    'Variation.id','Variation.sku','tVariation.stock_level',
                    'Product.title'
                ],
 ];

$this->DataTable->mDataProp = true;
$this->set('response', $this->DataTable->getResponse());
$this->set('_serialize','response');

fr0z3nfyr avatar Oct 19 '16 08:10 fr0z3nfyr