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
280
Column Fixing and Paste from Excel
posted

Hi,

I have grid in which 1 column (say A) if fixed and rest are not (B,C,....). I have implemented the paste from excel and followed the example. But I could see the indexes are different. For column A, it is 0 and for the columns (B,C...)  are again starting from 0. So, the pasting is not working as expected. Can anyone suggest any solution?

Thanks

Indra

Parents
  • 660
    Offline posted

    Hello Indra,

    After further investigating this matter, I have prepared a small sample by following the step-by-step guide in our Implementing Paste from Excel in igGrid topic here and configuring some of the columns to be fixed.

    The difference is in the custom getVisibleColumns function as it returns the visible columns after being fixed which causes the reordering when assigning the processed Excel data to the corresponding cell.

    The columns with their original order are retrieved on the igGrid’s created event by using the igGrid’s _columns property.

    // get visible columns
    
    var visibleColumns;
    
    $(document).on("igcontrolcreated", "#grid", function (evt, ui) {
        var columns = [];
        
        $(ui.owner._columns).each(function () {
            if (this.hidden !== true) {
                columns.push(this);
            }
        });
        
        visibleColumns = columns;
    });
     

    The result could be observed in the attachment below:

    Additionally, attached could be found my sample for your reference along with the sample Excel file. Please test it on your side and let me know how it behaves.

    Looking forward to your reply.

    Sincerely,
    Riva Ivanova
    Associate Software Developer

    4760.pasteFromExcel.zip

    8484.sample-data.xlsx

Reply Children