Skip to main content

I have a toggle filter on a table. When the filter is off so that all rows are shown, I’d like the rows that meet the criteria for the condition behind the filter to be highlighted or bold.

Any thoughts on the best way to accomplish this?

Thanks!

Use a field renderer snippet to check the model condition manually on every row. There are a bunch of examples on the community of how this can be done. Basically:

if(row.Condition_Field__c == whateverVal){
    highlightRow
}



Right.


Trouble is the condition I want to evaluate is the following subquery condition. Do I have to perform the subquery in javascript every time, or is there a better way (access the ‘value’ of the condition through the model somehow?)



OK a little more tricky… I don’t know the right way to do this. If you want to get crazy… :

1) Create a model on the Signature__c object, and recreate the subquery criteria as conditions on this model, set this model to NOT load data on page load, and LIMIT 1, call it “Signature”.
2) Have an additional condition where Interaction__c = “Empty_Value” filterable default off, name this condition “Interaction”. 
3) In your snippet, get the Id value of the current Interaction row. Then set this as the value for the “Interaction” condition.

e.g.


var signature = skuid.model.getModel('Signature');<br>var Id = field.row.Id;<br>var interaction = signature.getConditionByName('Interaction');<br>signature.setCondition(interaction, Id);<br>signature.updateData(function(){<br>&nbsp; &nbsp; if(skuid.model.getModel('Signature').data.length){<br>&nbsp; &nbsp; &nbsp; &nbsp; highlightRow();<br>&nbsp; &nbsp; }<br>});


PROS: This just may work
CONS: If you have more than a couple of rows, it will take forever for the page to load…


Actually my previous post is really dumb. Try this:

1) Clone your Interaction model and call it “InteractionSubquery”.
2) Change the subquery to always be on.
3) In your snippet, check if the current rows Id exists in the model that has the subquery on, that will indicate that it matches the criteria :

e.g.


var interactionSubquery= skuid&#46;model&#46;getModel('InteractionSubquery');<br />var Id = field&#46;row&#46;Id;<br />if(interactionSubquery&#46;getRowById(Id) != null){<br />&nbsp; &nbsp; highlightRow();<br />}



PROS: This should work awesomely
CONS: None that I can think of


Brilliant!


PROS:  Moshe Karmel being awsome…
CONS:  None that I can thing of! 



I’ve implemented this and it’s working perfectly. Thanks for being awesome, Moshe.

For posterity, here’s the code I’m using for a field renderer. I made it generic enough to use it on tables with different models. To use it, you just need to clone your models such that if your table’s model is MyModel, your clone is MyModelBold.


var field = arguments 0],<br />value = arguments 1],<br />$ = skuid&#46;$;<br />skuid&#46;ui&#46;fieldRenderersdfield&#46;metadata&#46;displaytype]sfield&#46;mode](field,value);<br />var subqueryModel= skuid&#46;$M(field&#46;model&#46;id + 'Bold');<br />var Id = field&#46;row&#46;Id;<br />if(subqueryModel&#46;getRowById(Id)){<br />&nbsp; &nbsp; field&#46;item&#46;element&#46;addClass('bold-row-text');<br />}