Forum


07:28

03/02/2009

Tony I have a grid which I want to edit the items in each row when finished the user clicks the "Submit Changes" button as below :-
$('#RAGroupData').jqGrid({
url: url,
datatype: 'json',
mtype: 'GET',
colNames: ['Group Name', 'Max Quantity', 'Position Limit', 'Position Offset'],
colModel: [{ name: 'GroupName', index: 'GroupName', width: 120, align: 'center', editable: false, sortable: true },
{ name: 'MaxQuantity', index: 'MaxQuantity', width: 120, align: 'center', editable: true, sortable: true, formatter: 'integer' },
{ name: 'PositionLimit', index: 'PositionLimit', width: 120, align: 'center', editable: true, sortable: true, formatter: 'integer' },
{ name: 'PositionOffset', index: 'PositionOffset', width: 120, align: 'center', editable: true, sortable: true, formatter: 'integer'}],
sortname: 'GroupName',
sortorder: "desc",
width: 1000,
imgpath: 'jscript/themes/basic/images',
toolbar: [true, "top"],
onSelectRow: function(rowid) {
if (rowid && rowid !== lastGroupRARowSelId) {
jQuery('#RAGroupData').restoreRow(lastGroupRARowSelId);
jQuery('#RAGroupData').editRow(rowid, true);
lastGroupRARowSelId = rowid;
if ($.inArray(rowid, rowLimitArray) == -1) {
rowLimitArray.push(rowid);
}
}
}
});
$("#t_RAGroupData").append("<input type='button' value='Submit Changes' style='background-color:#FFFFC0;height:20px;font-size:10px'/>");
$("input", "#t_RAGroupData").click(function() {
var ids = jQuery("#RAGroupData").getDataIDs();
if (ids.length != 0) {
for (var i = 0;i < ids.length;i++) {
var data = $('#RAGroupData').getRowData(ids[i]);
alert(data.MaxQuantity);
alert(data['MaxQuantity']);
}
}
});
However the data displayed is always "undefined" ? what am I doing wrong.
Many thanks
09:35

Moderators
30/10/2007

Hello,
Try to see what you have in ids variable, that holds the id's of the grid. Simple use FireBug to see the values of all operations when click.
Regards
Tony
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.
Most Users Ever Online: 715
Currently Online:
46 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