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

Is there any way to use containable behavior ?

Open nitish-mca opened this issue 9 years ago • 4 comments

Hi, Is there anyway to use containable behavior in datatable query ?

nitish-mca avatar Mar 11 '16 02:03 nitish-mca

Yes, just add the contain key to the configuration in the component. Depending on the type of relation you may not be able to sort on the associated columns (a second query may be used where a join is needed). You'll need to force a join using joins or re-binding the association in a different way.

tigrang avatar Mar 11 '16 17:03 tigrang

Hi, According to above suggestion i added code like : 'contain' => array('table name'),'joins' => array( array( 'table' => 'table name', 'alias' => 'table alias', 'foreignKey' => false, 'conditions' => [], 'type' => 'inner', ), ),

rule for this "table name" is not define in that particular model. but nothing happen. please correct where i am wrong ? is this necessary to define rule in model ? Also if i want to bind/unbind model for this plug-in then where to write code.

vermarenu avatar Mar 14 '16 06:03 vermarenu

I couldn't find the way for fetch data with recursive level 2. I had tried contain as well as join queries. I also try it with setting recursive 2

nitish-mca avatar Mar 14 '16 06:03 nitish-mca

@nitish-mca can you share some code. Also, take a look at http://mark-story.com/posts/view/using-bindmodel-to-get-to-deep-relations

If you can get the queries that are generated that would help. Thanks.

tigrang avatar Mar 15 '16 02:03 tigrang