To lock a column:
w2ui['grid'].columns[col_index].editable=false;
To lock a row:
w2ui['grid'].records[row_index].w2ui.editable=false;
-or-
w2ui['grid'].records[w2ui['grid'].get($(this).attr("recid"),true)].w2ui.editable=false;
-or-
records: [
recid: $(this).attr("ows_ID"),
'w2ui':{
style: {},
editable:($(this).attr("ows_columnName")=="Some Value")?false:true
}
]
To lock the full grid:
w2ui.grid.lock('Loading...', true); //second parameter is for the optional spinner
To lock a particular cell:
There is no out-of-the-box method to support this. However, you can target some of the HTML attributes of the cell to achieve this. You will have to look deep into w2ui js files to understand the working of editable cells.
Something like this may work:
$(window).load(function (){
disableCells ();
}
function disableCells()
{
var rowArr=w2ui['grid'].records;
$(rowArr).each(function() {
if($(this).attr("Column Name")=="SomeValue")
{
//column index = 5
//column name = Column5
$("#"+"grid_grid_data_"+w2ui['grid'].get($(this).attr("recid"),true)+"_5").html("<span>"+$(this).attr("Column5")+"<span>");
}
});
}
If windows.load fails to lock the cells then use the following:
$(window).on('load', function () {
w2alert('Welcome message/instruction.').done(function () {
disableCells();
});
});