php-crud-api
php-crud-api copied to clipboard
Order on column of included table
Is it possible to order a List by an includet Column?
for example: api.php/tbl_contacts?columns=contact_id,Name,EMail,tbl_contacttype.Description&include=tbl_contacttype&order=tbl_contacttype.Description&page=1,30
Hi, thank you for reaching out. That is not possible, but you may list the included table and include the original table and then list by the included column. I hope that helps.
Alternatively you can do client side sorting (using your own JavaScript implementation).
Then i guess i also can't filter on those columns, client side sorting and filtering is not an option, because if i use pages i can only filter one page.
Thanks for the help tho, will try your first suggestion
Yes or you can do two request, where you retrieve id's in the first and then do an "in" filter in the second. You need to combine those two results (manually) in JavaScript. Good luck!
I'll keep this open as a feature request.
Hey it's me.... again...i'm sorry... Is there any way i can combine All and Any in the Filter? so logically: Filter[]=id,cs,1 AND (Filter[]=name,cs,text OR Filter[]=adress,cs,text)
I do not want to download it and combine it manually, because i am using pages. Downloading everything would also be bad because of performance reasons
Edit: I want to Apply the one Filter on a Column that is also on an includet table. i tried using adding the table to the attribute and using different satisfy like said in your description but this did not work:
table: api.php/tbl_contacts? columns: columns=contact_id,Name,EMail,tbl_contacttype.ID_contacttype,tbl_contacttype.Description filter: &filter[]=tbl_contacttype.ID,eq,1&filter[]=Name,cs,text&filter[]=EMail,cs,text include: &include=tbl_contacttype order: &order=Name page: &page=1,30 satisfy: &satisfy=tbl_contacttype.all,tbl_contact.any
Edit 2.0: I found out that it works if i add the table to every attribute. Now it filters every table like it should, the only Problem is that every contact is shown, and only the one with the filtert contact type have the attribute. But i can work with that by just filtering out the one that does not have a contacttype.
Sorry for wasting your time and thanks for the help yesterday again.
Hey it's me.... again...i'm sorry...
Sure.. no problem. Although different issues would be better in different tickets :-).
Is there any way i can combine All and Any in the Filter?
This currently not supported as there is no nesting syntax.
Sorry for wasting your time and thanks for the help yesterday again.
Don't be. I'm glad you got it working. Enjoy the software!
You asked:
Is there any way i can combine All and Any in the Filter?
I answered:
This currently not supported as there is no nesting syntax.
But this is no longer true (in v2), see:
https://github.com/mevdschee/php-crud-api#multiple-filters
You can now combine AND and OR :-)
Enjoy!
There are no plans to support sorting on fields of included tables.
I'll keep this open as a feature request.