jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Getting a recordID when using singlecell
This topic contains 2 replies, has 2 voices, and was last updated by DavidSimmons 12 years, 7 months ago.
-
Author
-
I am using selectionmode: “singlecell” and it works great, but in need to get the value of column ID each time I edit a cell to pass to my ajax update. What is the best way to do this?
var datarowid = ************;
var source = {
datatype: “json”,
datafields: [
{ name: ‘ID’ },
{ name: ‘AppName’ },
{ name: ‘Created’ },
{ name: ‘CreatedBy’ },
{ name: ‘Updated’ },
{ name: ‘UpdatedBy’ }
],
url: “indexData.php”
};var dataAdapter = new $.jqx.dataAdapter(source);
$(“#jqxgrid”).jqxGrid(
{
width: 1000,
source: dataAdapter,
theme: theme,
columnsresize: true,
editable: true,
selectionmode: “singlecell”,
columns: [
{ text: ‘ID’, dataField: ‘ID’, width: 100 },
{ text: ‘AppName’, dataField: ‘AppName’, width: 200 },
{ text: ‘Created’, dataField: ‘Created’, width: 160 },
{ text: ‘CreatedBy’, dataField: ‘CreatedBy’, width: 160 },
{ text: ‘Updated’, dataField: ‘Updated’, width: 160 },
{ text: ‘UpdatedBy’, dataField: ‘UpdatedBy’, width: 160 }
]
});$(“#jqxgrid”).bind(‘cellvaluechanged’, function (event) {
var column = args.datafield;
var row = args.rowindex;
var value = args.newvalue;
var oldvalue = args.oldvalue;var datarowid = ************;
$(“#cellendeditevent”).html(“Event Type: cellvaluechanged, Column: ” + args.datafield + “, Row: ” + (1 + args.rowindex) + “, Value: ” + args.newvalue);
});
Hello DavidSimmons,
Here is how to get the value of the cell in column ID. Add this to your ‘cellvaluechanged’ event function:
var cellValueID = $('#jqxgrid').jqxGrid('getrowdata', row).ID;
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Got it, thanks…
-
AuthorPosts
You must be logged in to reply to this topic.