Adopt Rows into Model for 2 different objects and one of the model is lost on sorting table

We have a button and on click of button we run action . First action is query two different models from history object. 2nd action is Adopt rows in model and 3rd is open a pop up. Pop up has a table and that uses the model where we adopted rows.

Every thing works fine except
1. sorting the model does not work. It appends other model after the first one. 
2. If we do the UI sorting on table and user click on arrow, data from one of the model is lost. 

Anshul,
I think we may have already answered your question when working with you directly, but I wanted to go ahead and post an answer here in case anyone else encounters this issue.

If I understand the situation correctly, you’re adopting one model’s rows (call it Model B) into another model (call it Model A). The problems are:

  1. When Model B’s rows are adopted into Model A, Model B’s rows are simply appended at the end, rather than being sorted along with Model A’s rows based on Model A’s sort order.
  2. If you sort Model A’s table, rows from Model B are lost.
I hate to say it, but in order to achieve the result you’re looking for, you may end up tying your hands behind your back trying to get rows from two models behaving like one model. The Skuid Table components is really only designed to handle a single model, currently.

Here’s why you’re encountering the issues mentioned:
Both of these issues come down to the the difference between server-side and client-side operations. A model’s default sort order AND table sort are both server-side operations, while the “Adopt Rows” functionality is a client-side operation. Model sort order is only applied on model query, which is why rows are only sorted when Model A is first queries. Table sorting actually re-queries the table’s original model (Model A) from the server and refreshes the table based on these results, which is why Model B’s rows are dropped out of the table.

I hope this helps.
Emily