bookish Posted April 24 Report Share Posted April 24 Hello! Is there a way to disable the "View Details" record action if a certain [Field:Name] = "Test1" I already have datapages where the link to the details page is through a html block, and that is easy to hide based on a condition using javascript. Thanks in advance ! Quote Link to comment Share on other sites More sharing options...
Ilyrian Posted April 24 Report Share Posted April 24 Hi @bookish I think this article can help you achieve your goal.https://howto.caspio.com/tech-tips-and-articles/disabling-inline-edit-option-in-reports-based-on-a-condition/ You can change the InlineEdit with 'DetailsLink' And of course you could change the the condition in CalculatedField according to your needs. Hope it helps DemoC and bookish 1 1 Quote Link to comment Share on other sites More sharing options...
bookish Posted April 25 Author Report Share Posted April 25 Thank you! It worked with a tabular report datapage, however I am using List. Is there a portion of the script I need to change? Ilyrian 1 Quote Link to comment Share on other sites More sharing options...
Volomeister Posted April 25 Report Share Posted April 25 Hi @bookish You can do it without JavaScript 1. Use the calculated field to return a link you need as an HTML string. For example: CASE WHEN [@field:Name]= "Test1" THEN '<a href="detailsLink?parametername='+ [@field:RandomID]+ '">Details page </a>' ELSE '' END 2. Add this calculated field as HTML to HTML block: 3. Place the calculated field in 1st position and add the following CSS in the header of your DataPage: <style> dt:nth-child(1), dd:nth-child(2) { display: none; } </style> Hope it helps bookish, DemoC and Ilyrian 3 Quote Link to comment Share on other sites More sharing options...
bookish Posted April 26 Author Report Share Posted April 26 Thank you very much @Ilyrian and @Volomeister for the proposed solutions. The solution not to use a Javascript did not work for me. The Calculated field was not working. And as the View Details link still appeared, I thought I should choose No in "Do you need a Details Page for each record?" But the Calculated field seems to require a new datapage for which I don't have any more allowance in my plan. I went back to the topic which I started, use the solution of @DefinitelyNot31337 and it worked with my LIST type of report I just replaced all pertinent words with DetailsLink. Quote Link to comment Share on other sites More sharing options...
Volomeister Posted April 27 Report Share Posted April 27 Hi @bookish You can use the following JavaScript to remove default details link from the List report: <script> if (typeof rowPosition == 'undefined') { const rowPosition = 1 const targetValue = 'Test1' const removeDetailLinks = () => { document.querySelectorAll('[class*="cbResultSetListViewTable"]').forEach(container => { if(container.querySelector(`.cbResultSetData:nth-of-type(${rowPosition})`).innerText.trim() == targetValue) { document.querySelector('.cbResultSetPanelColumnarRAContainer').remove() } }) document.removeEventListener('DataPageReady', removeDetailLinks ) } document.addEventListener('DataPageReady', removeDetailLinks ) } </script> Where rowPosition is the position of the row where [Field:Name] label and its value are displayed targetValue stores the value you would like to check against. So when the value of [Field:Name] equals to targetValue, the details link will be removed bookish 1 Quote Link to comment Share on other sites More sharing options...
bookish Posted April 29 Author Report Share Posted April 29 On 4/27/2023 at 6:56 PM, Volomeister said: Hi @bookish You can use the following JavaScript to remove default details link from the List report: <script> if (typeof rowPosition == 'undefined') { const rowPosition = 1 const targetValue = 'Test1' const removeDetailLinks = () => { document.querySelectorAll('[class*="cbResultSetListViewTable"]').forEach(container => { if(container.querySelector(`.cbResultSetData:nth-of-type(${rowPosition})`).innerText.trim() == targetValue) { document.querySelector('.cbResultSetPanelColumnarRAContainer').remove() } }) document.removeEventListener('DataPageReady', removeDetailLinks ) } document.addEventListener('DataPageReady', removeDetailLinks ) } </script> Where rowPosition is the position of the row where [Field:Name] label and its value are displayed targetValue stores the value you would like to check against. So when the value of [Field:Name] equals to targetValue, the details link will be removed Thank you very much @Volomeister I will use this in similar needs in the future! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.