Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
135
Html.Infragistics().Grid
posted

Hello,

We are using the UI igGrid where we are listing orders (see screen caption). The user can either click on the View or Edit button which opens up a new browser window/tab where the order can be modified and saved (including the order status). What we want to do is when the browser window that the order list is on gets the focus again we would like to reload the page so that the order record that was just modified is refreshed with the updated order status and selected so that the user remembers which order they just modified was (for example Order 48842 as the illustration shows). How can I get the grid to select the row again and have the page post when the browser window gets the focus again.

Thanks!

Parents
  • 1300
    Offline posted

    Hello Richard,

    After investigating this further, I have determined that your requirement could be achieved by binding a method to the visibilitychange event. In this method the previously selected row would be saved to the localStorage and the page would be reloaded.

    Furthermore, on window load event the saved row in the localStorage would be selected. This could be achieved as follows:

    $(function () {

        window.addEventListener("load", function () {

           $("#grid").igGridSelection("selectRowById", localStorage.getItem("selectedRowID"));

        });

        document.addEventListener("visibilitychange", function () {

           if (!document.hidden) {

              localStorage.setItem("selectedRowID", $("#grid").igGridSelection("selectedRow")?.id);

             window.location.reload();

           }

        });

    });

    Please test it on your side and let me know if you need any further information regarding this matter.

    Regards,
    Monika Kirkova,
    Infragistics

Reply Children