Author Topic: How do I change a cell to read-only via the console (Chrume F12key)?  (Read 4217 times)

kjvjung

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 33
    • View Profile
Hello.

url:   https://paramquery.com/pro/demos/row_styles

How do I change a cell to read-only via the console (Chrume F12key)?

cell : rowIndx: 2, dataIndx: "revenues"

how?

thank you.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6313
    • View Profile
Re: How do I change a cell to read-only via the console (Chrume F12key)?
« Reply #1 on: November 17, 2017, 05:01:39 pm »
Individual grid cells are made read only by implementing editable callback function on columns as in this example:

https://paramquery.com/pro/demos/readonly_cells

Code: [Select]
editable: function(ui){
  if(ui.rowIndx == 2 && ui.dataIndx == "revenues"){
     return false;
  }
  else{
    return true;
  }
}

kjvjung

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: How do I change a cell to read-only via the console (Chrume F12key)?
« Reply #2 on: November 18, 2017, 07:20:33 am »
Thank you for your reply.
But your method is only suitable for the first loading.
I am in a situation that I need to change after loading.
So I asked the console what to do.

What should I do?

kjvjung

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: How do I change a cell to read-only via the console (Chrume F12key)?
« Reply #3 on: November 19, 2017, 12:24:57 pm »
Thank you for your reply.
But your method is only suitable for the first loading.
I am in a situation that I need to change after loading.
So I asked the console what to do.

What should I do?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6313
    • View Profile
Re: How do I change a cell to read-only via the console (Chrume F12key)?
« Reply #4 on: November 20, 2017, 10:21:24 am »
you can use this condition based on any arbitrary class.

Code: [Select]
editable: function(ui){
  return this.hasClass({
    rowIndx: ui.rowIndx,
    dataIndx: ui.dataIndx,
    cls: 'editable'
  });
}

and assign/ remove a class to cell at runtime.

Code: [Select]
  grid.addClass({rowIndx: 2, dataIndx: 'revenue', cls: 'editable'} );

kjvjung

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: How do I change a cell to read-only via the console (Chrume F12key)?
« Reply #5 on: November 25, 2017, 06:36:41 am »

grid.addClass({rowIndx: 2, dataIndx: 'revenue', cls: 'editable'} );

rowIndx is good.
However, dataIndx is always undefined.
So it does not work.

What should I do?

kjvjung

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: How do I change a cell to read-only via the console (Chrume F12key)?
« Reply #6 on: November 26, 2017, 07:56:49 am »
grid.addClass({rowIndx: 2, dataIndx: 'revenue', cls: 'editable'} );

rowIndx is good.
However, dataIndx is always undefined.
So it does not work.

What should I do?

--------------------------------




you can use this condition based on any arbitrary class.

Code: [Select]
editable: function(ui){
  return this.hasClass({
    rowIndx: ui.rowIndx,
    dataIndx: ui.dataIndx,
    cls: 'editable'
  });
}

and assign/ remove a class to cell at runtime.

Code: [Select]
  grid.addClass({rowIndx: 2, dataIndx: 'revenue', cls: 'editable'} );

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6313
    • View Profile
Re: How do I change a cell to read-only via the console (Chrume F12key)?
« Reply #7 on: November 26, 2017, 12:28:43 pm »
dataIndx is defined in column.editable callback. Please put the editable callback in columnTemplate if you want to use it for all/ most columns.