Row action to remove css class from row of a different table?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have three tables on a page, different models all on the same sObject.

I need a row action on one table to find any rows on the other tables with the same value for the Id field as the row action context row, and then remove a css class from those rows.

Anyone care to take a stab?

I can find the rows in the model that match, but I'm not sure how to connect them to the item in the tables.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Well,

This could definitely be more elegant, but it works:

var model = arguments[0].model,
    row = arguments[0].row,
    id = model.getFieldValue(row,'Id'),
$ = skuid.$;
var primaryCases = skuid.$M('PrimaryCases'),
    mergeCases = skuid.$M('MergeCases'),
    primaryItems = primaryCases.registeredItems,
    mergeItems = mergeCases.registeredItems;
    
$.each(primaryItems, function(){
    if (id == this.row.Id) {
        this.element.removeClass('primary-record merge-record');
    }
});
$.each(mergeItems, function(){
    if (id == this.row.Id) {
        this.element.removeClass('primary-record merge-record');
    }
});