Is there a way to sort (drag n drop) rows across multiple models?
eg.
I have a CMS with the models of:
-galleries
-pages
-links
I would like the user to be able to define the sort order of these items.
Each model has a row called ‘sort’.
I can’t figure out the correct active record usage to query and sort these and then update them.
The closest I can get is using multiple select with union.
SELECT `my_gallery`.`title`, `my_gallery`.`sort_order`
FROM my_gallery
WHERE (`my_gallery`.`user_id` = <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />
UNION
SELECT `my_pages`.`title`, `my_pages`.`sort_order`
FROM my_pages
WHERE (`my_pages`.`user_id` = <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />
ORDER BY `sort_order` ASC
But this doesn’t really do the job. I lose the information of two which table each row belongs.