How do I manipulate tr > td background with only selective rows.

I am using a low code no code tool where I cant pass custom class to particular areas, I have a tr > td >span>a I want to apply background color to this row. Note that I cant pass a custom class to that particular <tr> or <td>. All of the tr > td has a span tag but only some has <a> I want to change background of all <td> under that <tr> that carries <a> tag. Please find the attached screenshot. If more clarity is required or I missed something please let me know so I can explain further. Thanks in advance.
No description
50 Replies
ἔρως
ἔρως4w ago
AllaN
AllaN4w ago
I appreciate your prompt response but this isn't working either. I tried has pseudo operator earlier too but it applies on tr since tr doesnt take background css property all struggle in vain. I still thank you for replying.
ἔρως
ἔρως4w ago
the background on tr should work, but you can also apply it to all tds tr:has(> td a) > td <-- like this
AllaN
AllaN4w ago
I will try this bro, thanks. The module is currently in deveopment and its not visible on the frontend currently so I cant comment if it worked or not. Thanks a lot for giving your inputs brother much appreciated.
ἔρως
ἔρως4w ago
you're welcome
AllaN
AllaN3w ago
Hi bro so using this the structure becomes like this
No description
AllaN
AllaN3w ago
and background still remains white
AllaN
AllaN3w ago
And by using this whole table gets background
No description
Rowe2ry
Rowe2ry3w ago
I’d try #tableId tr:has(> td:has(a)) td{ background-color: #ddd } If this continues to not work, then I am assuming there is an anchor tag on every row. If you find out the different row only has anchors in the 4th column or something you could also try #tableId tr:has(> td:nth-of-type(4):has(a)) td { }
AllaN
AllaN3w ago
Let me try this one too. Thanks bro. The rows can be dynamic so nth of type wont be effective here. For some reason #tableId tr:has(> td:has(a)) td{ background-color: #ddd } its not getting applied, not visible in styles tab. #jsGrid_gridToShowCreatedSubmissions tr:has(> td:has(a)) td{ background-color: #ddd; }
ἔρως
ἔρως3w ago
can you control the html?
AllaN
AllaN3w ago
I cant control the grid tr td If that would have been possible life would be happier.
ἔρως
ἔρως3w ago
then can you add a class to the tr, if it will have a link?
AllaN
AllaN3w ago
I am sorry I mistyped I cant control*
ἔρως
ἔρως3w ago
ah, thats different
AllaN
AllaN3w ago
this works partially its getting applied on the row I am trying to manipulate
ἔρως
ἔρως3w ago
and what do you want to change?
AllaN
AllaN3w ago
Only that row's td's The rows that has this flow tr>td>span>a This a is important coz other rows flows like tr>td>span -> there is no a tag in these tried this tr:has(a)>td but its getting applied to each td of the table.
ἔρως
ἔρως3w ago
thats because all have a link tr:has(> td:last-child a) this should work
AllaN
AllaN3w ago
I will try this gimme a moment It didnt work sorry bro, not visible anywhere on styles tab 😭
Chris Bolson
Chris Bolson3w ago
just jumping in here... I feel that would much easier if you could provide the actual HTML table. Otherwise it really is just guess work.
ἔρως
ἔρως3w ago
whats the class of the link? yeah, we are just throwing "random" bs and hoping it sticks
Chris Bolson
Chris Bolson3w ago
for example this tr:has(a)>td should work. If it isn't, as has already been suggested, the other rows must also have links in them.
ἔρως
ἔρως3w ago
yes, and my suggestion should work too if it didnt, there has to be extra tds at the end
AllaN
AllaN3w ago
The msg is getting too big if I am sending it in formatted way will it be fine if I send in unformatted way? <table class="jsgrid-table"><tbody><tr class="jsgrid-row"><td class="jsgrid-cell" style="width: 100px;"><span><a type="button" href="javascript:void(0);" class="btn fas fa-angle-up"> Submission 1</a></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td></tr><tr class="jsgrid-row"><td class="jsgrid-cell" style="width: 100px;"><span>AIG Group</span></td><td class="jsgrid-cell" style="width: 100px;"><span>Cargo (Global Transit)</span></td><td class="jsgrid-cell" style="width: 100px;"><span>Cargo Global Transit Spec 1</span></td><td class="jsgrid-cell" style="width: 100px;"><span>26/09/2024</span></td><td class="jsgrid-cell" style="width: 100px;"><span>Ketan Kulawade</span></td><td class="jsgrid-cell" style="width: 100px;"><span>DRAFT</span></td><td class="jsgrid-cell" style="width: 100px;"><span><div class="dropdown"><button class="marketedit-btn fas fa-ellipsis-h" style="border: none; background-color: white;"></button><div class="dropdown-content"><a class="fa fa-edit" href="javascript:void(0);"> Amend Draft</a><a class="fa fa-trash" href="javascript:void(0);"> Delete Draft</a></div></div></span></td></tr><tr class="jsgrid-alt-row"><td class="jsgrid-cell" style="width: 100px;"><span><a type="button" href="javascript:void(0);" class="btn fas fa-angle-up"> Submission 2</a></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td></tr><tr class="jsgrid-row"><td class="jsgrid-cell" style="width: 100px;"><span>AIG Group</span></td><td class="jsgrid-cell" style="width: 100px;"><span>Cargo (Global Transit)</span></td><td class="jsgrid-cell" style="width: 100px;"><span>Cargo Global Transit Spec 1</span></td><td class="jsgrid-cell" style="width: 100px;"><span>27/09/2024</span></td><td class="jsgrid-cell" style="width: 100px;"><span>Shubham Lutade</span></td><td class="jsgrid-cell" style="width: 100px;"><span>DRAFT</span></td><td class="jsgrid-cell" style="width: 100px;"><span><div class="dropdown"><button class="marketedit-btn fas fa-ellipsis-h" style="border: none; background-color: white;"></button><div class="dropdown-content"><a class="fa fa-edit" href="javascript:void(0);"> Amend Draft</a><a class="fa fa-trash" href="javascript:void(0);"> Delete Draft</a></div></div></span></td></tr></tbody></table> Sorry for that mess
ἔρως
ἔρως3w ago
we just need a row
AllaN
AllaN3w ago
<tr class="jsgrid-row"><td class="jsgrid-cell" style="width: 100px;"><span><a type="button" href="javascript:void(0);" class="btn fas fa-angle-up"> Submission 1</a></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td><td class="jsgrid-cell" style="width: 100px;"><span></span></td></tr>
ἔρως
ἔρως3w ago
and the one that needs styles?
AllaN
AllaN3w ago
and the next row thats doesnt have a tag <tr class="jsgrid-row"><td class="jsgrid-cell" style="width: 100px;"><span>AIG Group</span></td><td class="jsgrid-cell" style="width: 100px;"><span>Cargo (Global Transit)</span></td><td class="jsgrid-cell" style="width: 100px;"><span>Cargo Global Transit Spec 1</span></td><td class="jsgrid-cell" style="width: 100px;"><span>26/09/2024</span></td><td class="jsgrid-cell" style="width: 100px;"><span>Ketan Kulawade</span></td><td class="jsgrid-cell" style="width: 100px;"><span>DRAFT</span></td><td class="jsgrid-cell" style="width: 100px;"><span><div class="dropdown"><button class="marketedit-btn fas fa-ellipsis-h" style="border: none; background-color: white;"></button><div class="dropdown-content"><a class="fa fa-edit" href="javascript:void(0);"> Amend Draft</a><a class="fa fa-trash" href="javascript:void(0);"> Delete Draft</a></div></div></span></td></tr> It needs background this doesnt.
ἔρως
ἔρως3w ago
you told us the opposite
Chris Bolson
Chris Bolson3w ago
but the next row does have a <a>
ἔρως
ἔρως3w ago
but hey, easy enough tr:has(.dropdown) and tr:not(:has(.dropdown)) that should do it
AllaN
AllaN3w ago
Ohhh no there is discs that carries dropdown and they have a tag sorry my bad guys OMG Love you guys THANKS A LOT
AllaN
AllaN3w ago
No description
AllaN
AllaN3w ago
@ἔρως +rep bro thanks for sticking by. Really mean a lot and everyone who jumped in to help.
ἔρως
ἔρως3w ago
this should be a tr with a td that has a coldpan of 5 or 6, depending on the number of tds that will be a lot easier to style you then can set the background of the table to white, and the td[colspan] to gray and it is a lot more maintainable
AllaN
AllaN3w ago
True but we cant manipulated the tr td of the grid limitations of Low Code No Code tools
ἔρως
ἔρως3w ago
🤮 low/no code
AllaN
AllaN3w ago
😂
ἔρως
ἔρως3w ago
but hey, if you dont have control, the selectors ive sent are probably the best options maybe only
AllaN
AllaN3w ago
tr:not(:has(.dropdown)) td{} this worked likka charm
Chris Bolson
Chris Bolson3w ago
I know that @ἔρως has already shown the solution but, now seeing the actual code, it is clear that there are multiple ways that this could be achieved. For example:
/* selecting "submission" row cells */
tr:has(td>span>a) > td
tr:has(.fa-angle-up) > td
tr:not(:has(.dropdown)) > td /* as per shown */
/* selecting "submission" row cells */
tr:has(td>span>a) > td
tr:has(.fa-angle-up) > td
tr:not(:has(.dropdown)) > td /* as per shown */
ἔρως
ἔρως3w ago
yeah, and all are flawed because of lack of control of the html
AllaN
AllaN3w ago
Thanks Chris next time onwards I will make sure to share the code snippet for better understanding
ἔρως
ἔρως3w ago
if you can show a live example with just the important part, that helps even more
AllaN
AllaN3w ago
True, I will keep this in mind bro. Thanks a lot once again.
ἔρως
ἔρως3w ago
you're welcome
AllaN
AllaN3w ago
Hi @ἔρως, I am stuck in kinda tricky situation where I need to add margin based on a condition. Its not getting applied. The HTML for that is huge. Is it fine if I may ask if we can try and find a solution to this over a voice channel?
Jochem
Jochem3w ago
if you have an issue that isn't related to this one, please make a new post. And please don't @ people to get them to help you, it's against the rules and puts folks on the spot
AllaN
AllaN3w ago
ok
Want results from more Discord servers?
Add your server