row action misbehaving on odd numbered rows

  • 1
  • Question
  • Updated 8 months ago
  • In Progress
  • (Edited)
I'm using a row action to populate a temporary model when a row is 'selected'. I set up the row action to execute a javascript snippet that should 
select(highlight) a row if none are already selected when it's chosen
unselect(unhighlight) a row if it's chosen a second time
or unselect(unhighlight) the previous row and select(highlight) the new row if a different one is chosen

I had this working in a different place in one of our other skuid pages, but for the current page it seems to only behave if you are hitting the row action on one of the even numbered rows...

Here is the javascript

AssociatedModel.abandonAllRows();
$.each(params.item.list.renderedItems, function(i, listItem){
    if(listItem.row.Id === contextRowId){ 
        if(alreadyHighlighted === false){
            listItem.element.addClass('highlighted-row');
            console.log('alreadyHighlighted was false');
            AssociatedModel.adoptRows([listItem.row]);
            UIModel.updateRow(UIModel.getFirstRow(), {
                                                addField: true,
                                                createField: false
                                            });
            rowSelected = true;
        } else {
            listItem.element.removeClass('highlighted-row');
            rowSelected = false;
        }
    }else{
        listItem.element.removeClass('highlighted-row');
    }
});
Photo of Jerry

Jerry

  • 1,150 Points 1k badge 2x thumb
  • like a parsnip

Posted 8 months ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
What is the difference between the page it is working on and the page it is failing on?
Photo of Jerry

Jerry

  • 1,150 Points 1k badge 2x thumb
There are virtually no differences, I duplicated the popup from the working instance in the new page piece by piece (extra models/fields and all)

The only thing I can think of is that the new one is one step further removed from the actual page. The original is a popup that is triggered by a button on the main page, the new one is a button that is on a popup already. I'm using the unique Ids of the tables to run the javascript and it is successfully running in part though so I don't think that's the issue.
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Can you paste the XML of the page it is NOT working on then post the XML of the page it is working on?