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
Allow beforeEditCell to abort edits
28/10/2008
08:37
Avatar
pat
Member
Members
Forum Posts: 9
Member Since:
14/10/2008
sp_UserOfflineSmall Offline

Allow beforeEditCell to abort edits by returning false. Since editing is turned on for an entire column, this would allow finer grained control.

29/10/2008
08:05
Avatar
zupert
Member
Members
Forum Posts: 18
Member Since:
29/07/2008
sp_UserOfflineSmall Offline

Hi pat and tony,

I met the same problem, and modified the source of grid.celledit.js the following way to meet those requirements.

Here my modifications, at line 72 and following. The principe is just adding a var to receive the value and being able to test it.

Greetings,

zupert

Code :


var followEdit = true;
if ($.isFunction($t.p.beforeEditCell)) {
	followEdit = $t.p.beforeEditCell($t.rows[iRow].id,nm,tmp,iRow,iCol);
}
if (followEdit !== false) {
	$(cc).html("").append(elc);
	window.setTimeout(function () { $(elc).focus();},0);
	$t.p.savedRow.push({id:iRow,ic:iCol,name:nm,v:tmp});
	$("input, select, textarea",cc).bind("keydown",function(e) { 
		if (e.keyCode === 27) {$($t).restoreCell(iRow,iCol);} //ESC
		if (e.keyCode === 13) {$($t).saveCell(iRow,iCol);}//Enter
		if (e.keyCode == 9)  {$($t).nextCell(iRow,iCol);} //Tab
		e.stopPropagation();
	});
	if ($.isFunction($t.p.afterEditCell)) {
		$t.p.afterEditCell($t.rows[iRow].id,nm,tmp,iRow,iCol);
	}
}

18/01/2009
15:31
Avatar
zchermit
zchermit
Member
Members
Forum Posts: 4
Member Since:
15/01/2009
sp_UserOfflineSmall Offline

Hi, Zupert, Pat and Tony!!

I also wanted to prohibit the editing of individual cells rather than the column immediately.

If you have managed styles for each cell (such as in the post Custom Cell Class) this could be quite simple: just check for class “readonly” in cell:

@@ -1351,6 +1360,7 @@
             td = (e.target || e.srcElement);
             if (td.href) { return true; }
             var scb = $(td).hasClass(”cbox”);
+            var ro = !$(td).hasClass(”readonly”);
             ptr = $(td,ts.rows).parent(”tr”);
             if($(ptr).length === 0 ){
                 ptr = $(td,ts.rows).parents(”tr:first”);
@@ -1365,7 +1375,7 @@
                     } else {
                         ri = ptr[0].rowIndex;
                         ci = td.cellIndex;
-                        try {$(ts).editCell(ri,ci,true,true);} catch (e) {}
+                        try {$(ts).editCell(ri,ci,ro,true);} catch (e) {}
                     }
                 } else if ( !ts.p.multikey ) {
                     if(ts.p.multiselect && ts.p.multiboxonly) {

Regards,

Serg.

Asche zu Asche...

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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