You can do it two ways, when opening the second view, when passing id of clicked row, also pass:
all other ids
whole filter form used to fetch data and then fetch only the ids
For the first point, remember that CGridView holds ids of all loaded rows in a hidden DOM container.
The second solution may seem an overkill at first glance, but it could allow to slightly alter the filter.
I once used this in a scenario when I had to display a ‘previous/next’ links in the details view. A range of ids would be fine, except for the first and last element on the list, that requires the last id from previous page or first from the next one.
Now if you have all the filter used to fetch data you can just modify the current page and fetch the proper ids.
After adding caching this didn’t do to many heavy queries and was quite flexible.
Thank you for your reply, the second solution looks better, as is it’s possible that I’ll make some modification then. Could you please give me an example how to pass the filter? This is how the form and CGridView looks like now (without the javascript):