Author Topic: turn edit option on programmatically for a specific column  (Read 2488 times)

elearnster

  • Pro Economy
  • Newbie
  • *
  • Posts: 20
    • View Profile
turn edit option on programmatically for a specific column
« on: August 13, 2014, 09:55:57 pm »
I am using "editable: false"as an option in the colModel.  I would like to make the column editable programmatically.  I tried the API below, but could not get it to work.  What API do you recommend and could you provide a little explanation?  Thanks  in advance.

//setter
//set editable of 2nd column
colM[1].editable = false;
$( ".selector" ).pqGrid( "option", "colModel", colM); 

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: turn edit option on programmatically for a specific column
« Reply #1 on: August 14, 2014, 05:24:32 pm »
a column or a cell can be programmatically made non-editable by implementing column.editable callback variant.

colM[1].editable = function( ui ){
  if ( some condition ){
    return true; //to enable editing
  }
  else {
    return false; //to disable editing.
  }
}