Forum
20:13
07/10/2014
 i have a column(Desc) in my gird as editable
{ name:'tDesc', index: 'Desc', width: 256, stype: 'text', sortable: false, editable: true, edittype: 'select',editoptions: {readonly: true},formatter: rowColorFormatter,editoptions: { value:"pre:pre; post:post" }},
and another column is date column which is not editable
{ name:'Date', index: 'Date', width: 256, editable: true, stype: 'text', sortable: true, sorttype: 'date', editoptions: { disabled: "disabled"} }
now based on date column i need to control some of the records to read only.
The logic is that to find the start date for this week and the start date for next week and only allow rows where the date is >= the start date for this week and < the start date for next week.
so i used in my aspx as like this
 var curr = new Date;
var firstday = new Date(curr.setDate(curr.getDate() - curr.getDay()));
 unction GetNextWeekStart() {
 var today = moment();
 var daystosunday = 0 - (1 - today.isoWeekday()) + 7;
 var nextSunday = today.subtract('days', daystoSunday);
 return nextSunday;}
Â
How can i use the above method in before edit cell to fulfill my requirement?
Â
beforeEditCell: function (rowid,name,val,iRow,iCol){
  if (rowid == 1){
  jQuery("#jqg_"+id,"#results").attr('editable',false);}},
Â
If your looking for cell level changes I suggest:
$("#results").removeClass('edit-cell').setCell(rowid,'columnname','','not-editable-cell');
12:57
Moderators
30/10/2007
Hello,
Â
The beforeEditCell will not work, since it is called after the check of non-editable-cell.
You can set a class not-editable-cell using cellattr event. See doc and this forum how to use it.
Â
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
34 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66