Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Some rows to read-only in jqgrid
14/10/2014
20:13
Avatar
mcfarland
Member
Members
Forum Posts: 11
Member Since:
07/10/2014
sp_UserOfflineSmall Offline
Hi,

  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');

21/10/2014
12:57
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 496

Currently Online:
28 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information