0

when i draw the grid i have some column like this..

name: 'codigo', index: 'codigo', width: 50, align: 'center', editable: true }

But after i want to do a query and then set the editable option, for example to false, is this possible?

Thanks.

bombai
  • 927
  • 1
  • 17
  • 27

1 Answers1

3

You can get reference to internal colModel using getGridParam:

var colModel = $("#grid").jqGrid("getGridParam", "colModel");

Now you can enumerate elements in colModel array and find the element which has property name with the value "codigo". After that you can modify editable property of the element of colModel array. Look at getColumnIndexByName function from the answer for a code example.

The most simple way to do what you want is the usage of setColProp method

$("#grid").jqGrid("setColProp", "codigo", {editable: false});
Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Oleg, can you help me with another problem drawing data? Here is.. http://stackoverflow.com/questions/15091661/wordwrap-in-a-cell-value-in-jqgrid Thanks again! – bombai Feb 27 '13 at 12:01
  • @bombai: I read the question, but not full understand it. Do you use custom formatter which includes `
    ` or you includes HTML fragments in the server response? Do you have any customization of CSS?
    – Oleg Feb 27 '13 at 12:07
  • Thanks for your response. I include the
    between two values in the string of the server response. Not, i havent any customization by CSS, and i cant implement the white-space option of CSS because one or both values can contains white spaces..I hope that you understand me this time. Sorry for my english. Thanks.
    – bombai Feb 27 '13 at 12:12
  • Can you help me or only is possible by CSS? Thanks again! – bombai Feb 28 '13 at 08:59
  • @bombai: Loot at the following answers: [this](http://stackoverflow.com/a/6915486/315935), [this](http://stackoverflow.com/a/3006134/315935), [this](http://stackoverflow.com/a/7256972/315935) and [this](http://stackoverflow.com/a/3641561/315935). I hope that you can solve your problem by usage of CSS described in the answers. – Oleg Feb 28 '13 at 09:04