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

how to use same reference field name in two different column? #14

Closed
atukilham opened this issue Jun 22, 2017 · 2 comments
Closed

how to use same reference field name in two different column? #14

atukilham opened this issue Jun 22, 2017 · 2 comments

Comments

@atukilham
Copy link

atukilham commented Jun 22, 2017

Thanks for your library, it's helped me so much..
I want to ask about use same field name in edit method for different column.
cz i want to make two column contain checkboxes, (eg: column A contain checkbox A, column B contain checkbox B), and use same field for value.
For 1 column in the table, it's possible to use $dt->edit(field_name, function), but how about two different column with same reference field name?
Can we use it?
Thanks.. (sorry for my bad english)

@n1crack
Copy link
Owner

n1crack commented Jun 22, 2017

Yes, it is possible.
Let's say you have three columns (id, title, body)

$dt->edit('id', function($data){
// you can access all columns data with $data
return $data['id'] . ' and ' . $data['title'] ;
});

And you can add same columns as much as you need with aliases.
' select id, id as cid, id as pid '

@atukilham
Copy link
Author

atukilham commented Jun 22, 2017

Thanks so much, @n1crack
It's work now..
omg, why i don't think use alias before this, haha..
thanks again... :

👍

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