Skip to content
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

Building dynamic links in the view based on values from a separate unrelated model #51

Open
salouri opened this issue Aug 18, 2014 · 3 comments

Comments

@salouri
Copy link
Contributor

salouri commented Aug 18, 2014

Tigrang thanks a lot for such a great plugin. I am building "delete" links that are based on (if-conditions) data from another un-related model!
Is there anyway to pass a variable/array from the controller to the Users/datatable/index.ctp view?
One I try to pass such array I find it passed to the users/index.ctp instead (the normal way). But I really need this array to build the actions links for the $this->dtResponse['aaData']

One aside question please: how do you add css classes to the in the view? I'm not using the helper. (manually)

Thanks

@tigrang
Copy link
Owner

tigrang commented Aug 26, 2014

For your second question, it's in jquery datatables documentation, I think in aoColumns setting.

If you use the normal $this->set('viewvar', 'data'); it should be available in the view file.

@salouri
Copy link
Contributor Author

salouri commented Aug 29, 2014

I solved my problem by creating an independent one-one relationship (hasOne) between the models which worked in my case (luckily). However, if such relationship could create unnecessary complications I don't know how would it be done then.
The $this->set() sends those variables to the main view, while the delete link is being created in the datatables/view file as part of making the $actions variable (for 'actions' => null in the controller).

@tigrang
Copy link
Owner

tigrang commented Feb 6, 2015

The same action is called when a datatable request is being made, so variables set with $this->set() in your action should be available in the datatables/view

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants