This topic is locked

close open details list page via code

4/11/2023 6:14:58 AM
PHPRunner General questions
W
wedi author

Hello,
In a list page with master records, I want to close an open details list page when a details list page of another master record is clicked.
The target is: only one details list page is open at a time.
My idea is to react to a click on a details link and save the itemid of the clicked details link to a variable (for example: "detailsid").
Before saving the itemid to this variable I check if "detailsid" has a value and if so, I simulate a click on this detailsid with jquery (for example: $("a[id=" + detailsid + "]").click();
Has anyone an idea for my requirement?
Regards,
Dieter

W
wedi author 4/22/2023

Has no one an idea?
Is it possible to check whether a details list is opened or not?
Regards,
wedi

fhumanes 4/22/2023

Hi @wedi,
I have been studying how it could be done and I think that with Jquery it can be done.
"Present" and "Hide" the data groups of the rows is relatively easy. I have to see how, too, with Jquery I scheduled an event so that when a data set is opened, others are closed.
Greetings,
fernando

fhumanes 4/24/2023

Hello,
Only for test, I have put a "custom button" on top of the Grid with this JavaScript:
$('div[data-itemid="details_preview"]:not([data-hidden="true"])').attr('data-hidden','true'); $('tr[data-cellid="grid_cell_dpreview"]:not([data-hidden=""])').attr('data-hidden',''); $('tr[id^="gridRow"][class="bs-details-opened"]').removeAttr('class').attr({'data-hidden':'','class':''});When you press, close all the "details" that were open.
I have scheduled to close the details when the mouse is positioned on the "hamburger" or "all" icon, with this code event page LIST "JavaScript OnLoad event"
$('a[data-itemtype="grid_alldetails_link"]').mouseenter(function() { // $('a[data-itemtype="grid_alldetails_link"]').dblclick(function() { $('div[data-itemid="details_preview"]:not([data-hidden="true"])').attr('data-hidden','true'); $('tr[data-cellid="grid_cell_dpreview"]:not([data-hidden=""])').attr('data-hidden',''); $('tr[id^="gridRow"][class="bs-details-opened"]').removeAttr('class').attr({'data-hidden':'','class':''}); console.log( "You clicked hamburguesa" ); });The final result is not "fine" and I could not in my developments.
Greetings,
fernando

W
wedi author 4/25/2023

Hello fernando,
your are great and, along with Corrie, one of the key supporters in PHPRunner's community.
Thanks for your time!
Regards
wedi

fhumanes 4/25/2023

Thank you very much @wedi