Forum


20:42

16/03/2010

I really need to get this working but I am out of Ideas as to what is wrong with it.
Here is my jqgrid
<script type="text/javascript">
var spainvid = $("#hiddenspainvid").val();
var lastsel;
var themeURL = '<%=AppHelper.themeImageUrl() %>';
var gridUr = '<%=ResolveUrl("~/SpaOrder/JsonAccessories")%>';
jQuery("#Accessorylist").jqGrid({
url: gridUr + '/' + spainvid,
datatype: 'json',
mtype: 'GET',
colNames: ['SpaPartUID', 'FieldDesc', 'price'],
colModel: [
{ name: 'SpaPartUID', index: 'SpaPartUID', width: 100, align: 'left', editable: false, editrules: { edithidden: true }},
{ name: 'FieldDesc', index: 'Description', width: 200, align: 'left', editable: false },
{ name: 'price', index: 'Price', width: 200, align: 'left', editable: true, edittype: 'text', editoptions: { size: 20, maxlength: 30} }
],
editurl:'<%=ResolveUrl("~/SpaOrder/JsonAccessories")%>',
pager: jQuery('#Accessorypager'),
rowNum: 10,
rowList: [5, 10, 20, 50],
sortname: 'id',
sortorder: "asc",
viewrecords: true,
onSelectRow: function(id) {
if (id && id !== lastsel) {
jQuery('#Accessorylist').restoreRow(lastsel);
jQuery('#Accessorylist').editRow(id, true);
lastsel = id;
}
},
imgpath: themeURL,
height: '250px'
});
</script>
I want to allow the price field to be editable. but when you cliick on the price field nothing happens, it just selects the row, and does not enter the edit mode.
please help if you can, what Am i missing?
06:52

24/03/2010

I have a working grid with inline editing, using almost the exact same code as you. The major difference I notice between our code is the onSelectRow function, I have a couple more settings in my editRow line:
onSelectRow: function(id){
if(id && id!==lastSelectedId){
jQuery('#list').restoreRow(lastSelectedId);
jQuery('#list').editRow(id,true,null,onSaveSuccess);
lastSelectedId=id;
}
Also in your code, unrelated to editing: I note that you have 'id' as a sortname. I believe you'll have to change that to one of your colModel column names to sort? I also see that "SpaPartUID" is set to editable:false, but then there are some edit rules listed. Maybe remove those?
If those changes fail to fix the problem, let me know and I'll post the full jrQrid page code.
PS: what command did you use to post your code? in most forums, it's [code] but that didn't work for me.
Most Users Ever Online: 715
Currently Online:
55 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