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
180
Is there a way to sort an IGX-Grid to bring selected rows to the top?
posted

I have one grid where I am adding files to a document storage system.  After the files are added, I go to a second grid which displays the documents available for further processing.  I would like the documents just added to be selected and at the top of the grid page.

   Thanks,

    Ted Herrlich

  • 1560
    Offline posted

    Hello,

    I have been looking into your question and prepared a small sample with an igx-grid and a button which adds a selected record at the top of the grid on click.

    In order to achieve this behavior once the record is added through the grid's addRow method I'm moving it to the top as follows:

    const lastRec = this.data.pop();
        const targetIndex = 0;
        this.data.splice(targetIndex, 0, lastRec);

    Then you could select the row by its primary key via the grid's selectRow method.

    My sample for your reference could be found here. Please test it on your side and let me know if I may be of any further assistance.

    Sincerely,
    Teodosia Hristodorova
    Software Developer