Paste new rows into grid

Originally Posted 13 February 2016, 4:08 am EST

  • Originally Posted 13 February 2016, 4:08 am EST

    Hi All,

    How can I paste new rows into FlexGrid and add new rows if needed? So, if I select last row and paste multiple rows from excel, can I have new rows added to the FlexGrid?

    Will appreciate any sample.

    Thanks,
    Pavlo
  • Reply

    Hello,

    FlexGrid cannot add new rows when you are pasting multiple rows while selecting a cell in the last row. As a workaround you can handle the pasting event of FlexGrid and add new rows to FlexGrid so as to copy paste the data by adding new rows to FlexGrid. Here is the sample code:


    $scope.pasting = function (s, e) {
    var pastedText;
    console.log("pasting");
    if (e.row == $scope.flex.rows.length - 1) {
    pastedText = window.clipboardData.getData('Text');
    if (pastedText.split("\n").length > 1) {
    for (var i = 0; i < pastedText.split("\n").length - 2; i++) {
    $scope.flex.collectionView.addNew();
    $scope.flex.collectionView.commitNew();
    }
    }
    }
    $scope.flex.select(e.row, e.col);
    }


    If you copy four rows from Excel and perform the paste operation by selecting the first cell in the last row, then it adds three new rows to FlexGrid and hence pastes four rows into FlexGrid.

    Hope it helps.

    Thanks,
    Manpreet Kaur
    2016/02/New_Paste.html
  • Reply

    Hello,

    I apologize for the delayed response.

    I am working on your query to find a feasible solution for the describe scenario. I would soon share my observations on the same.

    Thanks,
    Manpreet Kaur
  • Marked as Answer

    Reply

    Hello Simon,

    I have an alternative approach to paste new rows in grid. Please check the given fiddle link and let me know if it is helpful to you.

    http://jsfiddle.net/mkgupta911/f7vyLcmz/
  • Reply

    Hi

    I'm currently evaluating FlexGrid for our needs -- struggling with the pastedText code above -- it does not seem to work in Chrome. Are there other options, perhaps using the wijmo clipboard support to grab the contents of the clipboard reliably?

    Thanks
    Simon
  • Reply

    Is the above code available for VB.net? I am attempting to paste multiple excel records to flex grid connected to a database.

    Thanks
  • Reply

    Hello,

    The Wijmo FlexGrid supports VB javascript and doesn't provide support for VB.net. Could you please confirm if you are using MVC?

    Regards
  • Reply

    thanks
  • Reply


    So does it work on chrome or not ?
  • Reply

    Hi,
    The Wijmo FlexGrid works fine on all the browsers. Please let us know if you have any specific feature that is not working on browser. Wijmo FlexGrid is created using PureJs and it works on all the JS-supported browser.

    Regards,
    Manish Gupta
  • Reply

    Hi Team,
    I am working on Angular js , FLexgrid in that we have custom cut ,copy , paste menus when user clicks inside the Grid cells. Currently for Internet Explorer we can able to paste the content from Clipboard to Grid cells using custom paste command like [ document.execCommand('paste'); ] , but this command is not working in Chrome and Edge since this command is depreciated for the chrome and Edge browsers. Can you let me know is there any command for the paste in FlexGrid cells or its not possible in Chrome and Edge browsers
  • Reply

    Hello,

    We have provided a response for the same on the support portal. Please refer to the link for the same: https://www.grapecity.com/my-account/my-support/case/CAS-31963-M9C2C3

    Regards
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels