adoptRows function not working?

Not sure what I’m missing TBH.

I have 2 models based on the same object with the same fields. The first model loads on page load. The second model loads on tab loading for first time in tab set.

The second model does get rows but the adoptRows() function isn’t doing anything. Tried in snippet and in console.

Tried in console:
skuid.$M(‘FirstModel’).adoptRows(skuid.$M(‘SecondModel’).data)
skuid.$M(‘FirstModel’).adoptRows(skuid.$M(‘SecondModel’).getRows())

According to the documentation, you must provide an array of objects (rows) as the first parameter. Both .data and .getRows() do provide this when I enter them in the console.

It’s my understanding that adopting rows from the second model to the first model ignores conditions used to initially query for rows in the first model. I can’t imagine that they would be used to “filter” incoming adopted rows. Other than this, I can’t make sense of what’s going on.

This is on version 10.0.10 and 11.1.7.

Not sure this will help, but we have a working adopt situation where users select rows from a table then click an action that adopts the selected rows into another model.  I thought it might help you de-bug your situation.  We don’t have the filtering and querying behavior like you, just carrying data from one model to another to then manipulate it.



var params = arguments[0],

    list = params.list,
    selectedItems = params.item ? [params.item] : list.getSelectedItems(),
$ = skuid.$;

SourceModel = skuid.model.getModel(‘FirstModel’);
AdoptModel = skuid.model.getModel(‘SecondModel’);

AdoptModel.abandonAllRows();

$.each( selectedItems,
    function( j, item1 )
    {
        AdoptModel.adoptRows([item1.row]);
    }
);

So … yeah. It was malfunctioning. The row I was trying to adopt was already in the model. :confused: Just didn’t notice. :smiley:

FYI. SOLVED.

User error. :wink:

Thanks for closing the loop Pat. This feels like something that would have tripped me up too - how did you ultimately figure it out?