jQWidgets Forums

jQuery UI Widgets Forums Grid Disable pasting of rows into grid?

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 10 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Disable pasting of rows into grid? #60545

    jonfrain
    Participant

    Hello,

    I want to be able to copy rows of data from my grid and paste into excel, which is working, but I don’t want to be able to copy a row from the grid and paste it into another row in the grid. I was hoping that editable: false would be enough but apparently that is not the case.

    width: '100%',
    source: myDataAdapter,
    autoheight: true,
    pageable: true,
    sortable: true,
    altrows: true,
    filterable: true, //true,
    columnsresize: true,
    virtualmode: true,
    editable: false,
    selectionmode: 'multiplerowsextended',       
    autoshowfiltericon: true,
    Disable pasting of rows into grid? #60573

    Dimitar
    Participant

    Hello jonfrain,

    As shown in the demo Custom Keyboard Navigation, you can change the effect of pressing keys in grid. In your case, you would have to do this for the Ctrl+V combination (Paste), as follows:

    $("#jqxgrid").jqxGrid(
    {
        width: 850,
        source: dataAdapter,
        columnsresize: true,
        editable: true,
        ready: function () {
            $("#jqxgrid").jqxGrid('focus');
        },
        editmode: 'selectedcell',
        selectionmode: 'singlecell',
        handlekeyboardnavigation: function (event) {
            var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
            if (key == 86 && event.ctrlKey == true) {
                return true;
            }
        },
        columns: [
            { text: 'Date', datafield: 'Date', cellsformat: 'D', width: 250 },
            { text: 'S&P 500', datafield: 'S&P 500', width: 300, cellsformat: 'f' },
            { text: 'NASDAQ', datafield: 'NASDAQ', cellsformat: 'f' }
        ]
    });

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.