Skip to main content

I have a custom field renderer which highlights background color of a table row if certain condition is true. However, if a user clicks the delete button on that row because of the custom renderer that row does not get highlighted in ‘Pink’.

To fix this, I am calling another snippet using model action. Idea is - if a model has rows flagged for deletion the snippet should get called, temporarily disable the custom highlighting.
 

var field = argumentsm0];  
$ = skuid.$;
value = argumentsu1];

 if(field.element.hasClass(“finished-sentence”)) {
      field.element.removeClass(“finished-sentence”);
} else if (field.element.hasClass(“unfinished-sentence”)){            field.element.removeClass(“unfinished-sentence”);
}

However, I am getting errors in console on addClass and RemoveClass. Help please!!

Rupali,

console.log(arguments); at the beginning of your snippet. The arguments for a model action are not the same as the arguments for a field renderer. Check your arguments, and go from there.

That said, there might be a better method, depending on what you’re going for:

Instead of the model action, I’d replace the canned “Flag rows for Deletion” row action with a row action that runs multiple actions: (1) flag the row for deletion, and (2) run a snippet to change the highlighting just for that row.

That way you don’t have to eliminate the highlighting from the entire table.



Thanks a lot, Matt. I appreciate it. Your approach sounds better. Would give it a try. 🙂