Author Topic: Disable paste (ctrl+v) for Columns of Select type  (Read 2290 times)

rsgmedia

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
Disable paste (ctrl+v) for Columns of Select type
« on: December 19, 2016, 03:53:20 pm »
We want to disable copy/paste for columns in grid which are of select type. Right now we are using pasteModel which is applying to entire grid.

Is there any option to achieve it.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Disable paste (ctrl+v) for Columns of Select type
« Reply #1 on: December 20, 2016, 10:58:26 pm »
I don't see any option to do that. I've added this to the feature request list.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Disable paste (ctrl+v) for Columns of Select type
« Reply #2 on: January 07, 2017, 06:10:13 pm »
Columns can be made uneditable selectively in beforeValidate event.

Code: [Select]
            beforeValidate: function(evt, ui){
                if( ui.source === 'paste' ){

                    var column = this.getColumn({ dataIndx: 'dataIndx_of_column' });
                    var old_val = column.editable;
                    column.editable = false; //make in uneditable during paste.

                    this.one('change', function(){
                        column.editable = old_val;
                    });
                }
            },

Hope this helps.
« Last Edit: January 07, 2017, 06:12:14 pm by paramquery »