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
105
Copy Paste Not working for Grid2 in IGX
posted

Hi Team,

I am using a collection and iterating it to show multiple igx-grids. Copy paste is working for First grid. While we are trying to paste in 2nd grid , the First grid data is being passed always and is not pasting the values. I have created the same config in below sample. Kindly let me know how to handle Copy Paste in Multiple IGX Grids which are cloned using a single collection with different data.

stackblitz - Infragistics Angular Components - StackBlitz

  • 460
    Offline posted

    Hello,

    I have been looking into your question and unfortunately your sample didn't work for me, but still what I understood is that you iterate through a given collection and create a separate grid on each iteration, with different data you want each grid to have a copy paste feature implemented, but for you it only works for the first one.

    In fact, this is the expected behavior of your sample because you create two grids with the same references and handle the dataProcessed event of the grids with the same function, and adding and updating records again work with the same functions for both grids. In the given sample from our Angular documentation, a grid is created with all the necessary functions and event handlers, as well as the addition of a paste-handler directive, but only for one grid. For the copy/paste feature to work for all grids in your application you need to create functions to add/update rows, undo, redo, commit and handle the dataProcessed event of each grid separately so that each grid can modify itself and not all grids as you create them with the ngFor directive have one function that actually only works for the first one because its reference is used.

    What I could suggest you as an approach is if there is an opportunity to rewrite your custom logic or minimally change it so that you create each grid with its reference and for each grid there are separate functions that perform the copy/paste feature for the given grid. For this purpose, you can create each grid in a separate component and then create such a component after iterating through the collection or at best approach if you know how many grids you will have in your application create them for example if they only need to be in one component and to make the necessary functions for each of them to perform copy/paste.

    All functions and event handlers could be found in the given sample from our Angular documentation or in the sample I will provide you with more detailed explanations for two grids copy/paste.

    The described scenario could be observed here:

     

    In addition, I have prepared small sample illustrating this behavior which could be found here. Please test it on your side and let me know how it behaves.

    If you require any further assistance on the matter, please let me know.

    Regards,

    Georgi Anastasov

    Entry Level Software Developer

    Infragistics