Forum


19:10

20/11/2009

Hi, all
I tried to empty cell content before edit it, here is my code
formatCell: function(rowid, cellname, value, iRow, iCol) {
$('#mygrid').setCell(rowid,cellname,null,null,null);
},
I also tried beforeEditCell event, both event triggered. But the cell still has old value while editing, not a empty cell I expect.
How can I get a empty cell while editing, so I don't have to delete old value first?
Thanks,
03:45

20/11/2009

I used editRow method to edit my rows and in oneditfunc I reset the input value like this:
$('#mygrid').editRow(rowId, true, function() {
var input = $('#' + rowId + '_yourColumnName');
input.val(null);
});
}
You can also access the original value if needed, like this:
Because cells values are also stored in the <td> title attribute.
If you want this behavior to be applied to all columns, you can iterate over all the visible columns or just ask all inputs from the given <tr> by using jQuery.
12:19

20/11/2009

Thanks for your tip. It's strange that won't work for me. I am using 3.5.3. After google around, I found something work for me. Post here in case somebody also need this.
afterEditCell : function(rowid, cellname, value, iRow, iCol) {
$("#sales tr[id='"+rowid+"'] td:eq("+iCol+") input").val("");
},
BTW: cell property like this editable:true,edittype:'text'
Most Users Ever Online: 715
Currently Online:
53 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