Paste new rows into grid

Posted by: pavlo on 14 September 2017, 11:30 am EST

    • Post Options:
    • Link

    Posted 14 September 2017, 11:30 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

  • Posted 14 September 2017, 11:30 am EST

    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:

    [js]

    $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);

    }

    [/js]

    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

  • Posted 14 September 2017, 11:30 am EST

    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

  • Posted 14 September 2017, 11:30 am EST

    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

  • Posted 14 September 2017, 11:30 am EST

    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/

  • Posted 25 May 2022, 7:31 pm EST

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

    Thanks

  • Posted 26 May 2022, 3:24 am EST

    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

  • Posted 26 May 2022, 12:14 pm EST

    thanks

  • Posted 2 June 2022, 10:00 am EST

    So does it work on chrome or not ?

  • Posted 2 June 2022, 11:06 pm EST

    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

  • Posted 13 June 2022, 12:16 am EST

    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

  • Posted 15 June 2022, 12:59 am EST

    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