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
Inline edit and dynamically controlling cell editing
01/12/2011
02:31
Avatar
Pete
Member
Members
Forum Posts: 100
Member Since:
01/09/2008
sp_UserOfflineSmall Offline

I found some code that Oleg posted here: http://www.ok-soft-gmbh.com/jq.....ynamic.htm that shows how cell editing can be dynamically controlled.  The only problem is that it uses a cell editing approach rather than a row editing approach which breaks my application.

Preventing editing on the column by setting the column editable= false works for existing records but when I add a new row to the grid I want all the columns in the empty row to be editable so new data can be entered.

Can you think of any way to accomplish this?  If seems that the inline editing doesn't allow for modifications of the cell attributes (like setting the class = 'not-editable-cell'  or removing the class).  I want one column to NOT be editable *except* when a new row is added that has empty cell content.  Ideas?  (running 3.8.2 of jQGrid currently)

Thanks!

01/12/2011
19:00
Avatar
Pete
Member
Members
Forum Posts: 100
Member Since:
01/09/2008
sp_UserOfflineSmall Offline

A  little trial and error got this to work.  In my onSelectRow function I added this:

         var grid = $('#myGrid');
         var colContent = grid.jqGrid('getCell',id,'myColumn');
         if(colContent.length>0)
             grid.setColProp('myColumn',{editable:false});
         else
             grid.setColProp('myColumn',{editable:true});

This does exactly what I was hoping to do.  When I have a column that already has content that I want to "protect" from editing, this makes the column not editable.  But when I have blank data, I can edit the field.

Posted here so if someone comes across the same issue they can get a quick solution.

02/12/2011
01:38
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Pete,

You posted link to my old code from the answer so I decide that I should wrote you. If you use inline editing you can set "not-editable-row" class to disable editing of some rows (see here for example).

Look at the answer or this one in case of inline editing and the answer for the form editing. The solution which you found yourself use the same technique.

Best regards
Oleg 

02/12/2011
02:19
Avatar
Pete
Member
Members
Forum Posts: 100
Member Since:
01/09/2008
sp_UserOfflineSmall Offline

Thanks Oleg! I am not sure how I missed those posts, it could have saved me some work!

I appreciate the follow up.

Pete

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
32 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