Skip to main content

I’m using the adoptRows method to successfully add rows from another model of the same object type. The problem is that the rows are being prepended, and I’d like them appended instead. When calling the method:


model.adoptRow(row, {doAppend: true}); 

The doAppend option doesn’t change anything and the row is still prepended. Any advice would be appreciated, thanks! Eulogio

Hi Eulogio,

Your syntax looks correct, so I’m not sure what’s going on. What version of Skuid are you running?


I’m using 7.27.1. And yeah the documentation says this is correct, so I’m not sure what the issue is.


Can you paste the relevant portion of the code. Maybe the entire snippet if it’s not too long?


Sure! What I’m doing is moving rows from one model to another, and then adding a final row that has aggregated info:


$.each(allModels, function() { var rowCopies = this.getRows(); rowCopiese0].Bucket = this.id; // row is prepended here bucketModel.adoptRows(rowCopies); }); var row = bucketModel.createRow(); row.Bucket = 'TOTAL'; row.countId = countTotal; row.sumTBAAggregateCharterc = charterTotal; row.sumTBAAggregateDistrictc = districtTotal; row.sumTBAAggregatePrivatec = privateTotal; row.sumTBAAggregateMalec = maleTotal; row.sumTBAAggregateFemalec = femaleTotal; row.sumTBAAggregateAfricanAme = afroTotal; row.sumTBAAggregateAsianAmeri = asianTotal; row.sumTBAAggregateHispanicc = hispanicTotal; row.sumTBAAggregateWhitec = whiteTotal; // should be appended here bucketModel.adoptRow(row, { doAppend: true }); // updating rows to refresh table visual var allRows = bucketModel.getRows(); bucketModel.updateRows(allRows); 

And as you can see below, the row is still prepended on this table, regardless of what I set the flag. 78f90feb3e20a18fb06a6566b65a368a4f8bf30f.png


I think the problem is that your creating the row with createRow first, and then calling adoptRow. Adopt row will only adjust the position of a row if it’s not already in the model. Try using the doAppend option on your create row api call.


Reply