Quickly Add Unique Identifier to Blox Action Buttons Without Modifying Blox Template
with a very similar line:
This results in Blox generating the following HTML with inline styling:
<ul class="action-set">
<li class="action">
<button class="btn btn__text" style="font-size: 13.01px;">
Button Text
</button>
</li>
</ul>
This then allows that unique button to be selected via the CSS selector (used in code):
This was then repeated for all other buttons (13.02, 13.03...) in both the template and code. The standard Javascript querySelector or jQuery (included in all Sisense web pages) can use this as a CSS selector to return the specific button.
This method is valid because CSS treats inline style as any other HTML attribute, so the attribute selector in modern CSS can be used, by treating the "style" parameter as any other HTML attribute of an element.
As would be expected, this hundredth pixel does not affect the actual rendering of the button, and while not at all necessary can be identically by using the thousandth decimal place or smaller.
While Blox does place action font-size styling inline, it is worth emphasizing that this kind of pseudo-recursive CSS selectors based on inline styling, is only possible when styling is inline and not applied via stylesheets.
This request is rather unique, and this method was only required due to the very specific nature of the request and the customer's specific concerns, but the method was unusual and unexpected and worth noting for other Sisense users who may have a similar restrictive use case of selecting otherwise unique Blox action buttons and making very minimal changes to the Blox templating of a Blox type widget.
Jeremy Friedel
OP2 years agoThanks David 😎
DRay
·2 years agoThank you Jeremy for another great article. Your willingness to share knowledge is much appreciated! 😎