Power pages custom button add in gried

 


$(document).ready(function () {

    // Loop through table rows after entity list loads

    $(".entity-grid .view-grid table tbody tr").each(function () {

        var recordId = $(this).attr("data-id"); // row GUID

        if (recordId) {

            var viewBtn = `<button class="btn btn-primary btn-sm view-btn" 

                            onclick="openDetails('${recordId}')">View</button>`;

            $(this).find("td:last").append(viewBtn); // put button in last column

        }

    });

});


function openDetails(id) {

    // Replace with your detail page URL

    var detailPageUrl = "/bankaccount-details/";

    window.location.href = detailPageUrl + "?id=" + id;

}


Comments

Popular posts from this blog

Power Automate compose vs variable

Update record when checkbox checked using JavaScript and save d365