Forum



16:20

18/06/2012

hi,
i am using this code to do inline editing in jqgrid.I have used action formatter to do inline editing.but when i click on 's' (save) button then
function SaveStudentEvaluation called.problem is that in this fuction
var row = $("#tblgrid").jqGrid('getRowData', index); to get row data of particulay row.it should give value when i write var name = row.BandName;but instead of value ,this line row.BandName returns html value
so, how can i get that updated cell value after performing edit and then save ?
plz experts help me out, i am stucked at this point
**********************************************************************************************************
this is my .js file
**********************************************************************************************************
var result = [];
$(document).ready(function () {
$("#AddNewCommon_BandsDialog").dialog({
width: 500,
modal: true,
autoOpen: false,
buttons: {
"Save": function () {
AddNewBands();
},
"Cancel": function () {
$(this).dialog("close");
}
}
});
LoadData();
});
function LoadData() {
var grid = $("#tblgrid");
grid.jqGrid({
url: '../Demo/GetBands',
datatype: 'json',
mtype: 'GET',
postData: {},
width: 750,
colNames: ['BandID', 'BandName',''],
colModel: [
{name: 'BandID', align: "center", index: 'ID' },
{ name: 'BandName', align: "center", index: 'Name', editable: true,edittype: 'text' },
{ name: 'act', index: 'act', width: 40, sortable: false,formatter: ActionFormatter },
],
jsonReader: {
repeatitems: false
},
editurl: '#',
ignoreCase: true,
height: '100%',
rownumbers: true,
rowNum: 5,
rowList: [5, 10, 20, 50],
viewrecords: true,
sortorder: "desc",
forceFit: false,
pager: '#dvBands',
caption: "Bands Detail",
recordtext: "View Band {0} To {1} Of {2}",
emptyrecords: "No Record Found",
shrinkToFit: true
}).jqGrid('navGrid', '#dvBands',
{
search: false, edit: false, add: true, del: true, view: false,
refresh: false,
alertcap: "Bands Error",
alerttext: "<ul style='color:#FF3300'><li>Please select Linkage.</li></ul>",
searchtext: "Search",
searchtitle: "Search Detail(s)",
addtitle: "Add Detail",
addtext: "Add",
addfunc: AddBands,
// edittext: "Update",
// edittitle: "Update Selected Detail",
/*editfunc: UpdateNewJoinee,*/
viewtext: 'View',
viewtitle: 'View Selected Bands',
/*viewfunc: ViewNewJoinee,*/
deltext: 'Delete',
deltitle: 'Delete Selected Bands',
delfunc: DeleteBands,
position: "left"
},
{}, // default settings for edit
{}, // default settings for add
{}, // delete
{closeOnEscape: true, multipleSearch: false,
closeAfterSearch: true }, // search options
{}
);
}
function ActionFormatter(cellvalue, options, rowObject) {
var ret;
ret = '<input id = "btnedit' + options.rowId + '" style="height:22px;width:20px;" type="button" value="E" onclick="editcall(' + options.rowId + ');" />';
ret = ret + "<input id='btnsave" + options.rowId + "' style='height:22px;width:20px;display:none;' type='button' value='S' onclick="javascript:SaveStudentEvaluation('" + options.rowId + "');" />";
ret = ret + "<input id='btncancel" + options.rowId + "' style='height:22px;width:20px;display:none;' type='button' value='C' onclick="cancelcall('" + options.rowId + "');" />";
return ret;
}
function SaveStudentEvaluation(index) {
debugger;
saveparameters = {
"successfunc": null,
"url": null,
"extraparam": {},
"aftersavefunc": null,
"errorfunc": null,
"afterrestorefunc": null,
"restoreAfterError": true,
"mtype": "POST"
}
jQuery("#tblgrid").jqGrid('saveRow', index);
// jQuery("#tblgrid").jqGrid('saveRow', index, saveparameters);
var row = $("#tblgrid").jqGrid('getRowData', index);
var name = row.BandName;
jQuery("#tblgrid").jqGrid('editRow', index);
$("#btnedit" + index).css("display", "block");
$("#btnsave" + index).css("display", "none");
$("#btncancel" + index).css("display", "none");
}
function editcall(cl, drp) {
jQuery('#tblgrid').editRow(cl);
$("#btnedit" + cl).css("display", "none");
$("#btnsave" + cl).css("display", "block");
$("#btncancel" + cl).css("display", "block");
}
function cancelcall(cl) {
jQuery('#tblgrid').restoreRow(cl);
$("#btnedit" + cl).css("display", "block");
$("#btnsave" + cl).css("display", "none");
$("#btncancel" + cl).css("display", "none");
}
function LoadData1() {
var grid = $("#tblgrid");
grid.jqGrid({
url: '../Demo/GetBands',
datatype: 'json',
mtype: 'GET',
postData: {},
width: 750,
colNames: ['BandID', 'BandName'],
colModel: [
{ name: 'BandID', align: "center", index: 'BandID' },
{ name: 'BandName', align: "center", index: 'BandName' },
],
jsonReader: {
repeatitems: false
},
editurl: '#',
ignoreCase: true,
height: '100%',
rownumbers: true,
rowNum: 5,
rowList: [5, 10, 20, 50],
viewrecords: true,
sortorder: "desc",
forceFit: false,
pager: '#dvBands',
caption: "Bands Detail",
recordtext: "View Band {0} To {1} Of {2}",
emptyrecords: "No Record Found",
shrinkToFit: true
});
}
function saveBands() {
debugger;
$.post('../Demo/UpdateBands',
{ BandID: BandIDContent, BandName: BandNameContent },
function (data) {
if (data == "True") {
LoadData();
}
});
}
function DeleteBands() {
debugger;
var row_id = jQuery("#tblgrid").jqGrid('getGridParam', 'selrow');
$.post('../Demo/DeleteBands',
{BandID:row_id},
function (data) {
if (data == "True") {
LoadData();
}
});
}
function AddBands() {
$("#AddNewCommon_BandsDialog").dialog({ title: "Add New Common_Bands" });
$("#AddNewCommon_BandsDialog").dialog("open");
$("#AddNewAreaDialog input").css("border-color", "silver");
}
function AddNewBands() {
var BandName = $("#txtCommon_Bands_BandName").val();
$("#AddNewCommon_BandsDialog").dialog("close");
$.post('../Demo/AddBands',
{ BandName: BandName },
function (data) {
if (data == "True") {
LoadData();
}
});
}
Most Users Ever Online: 715
Currently Online:
51 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