jQWidgets Forums
jQuery UI Widgets › Forums › Grid › setcellvalue issue
This topic contains 4 replies, has 2 voices, and was last updated by DavidSimmons 12 years ago.
-
Authorsetcellvalue issue Posts
-
When editing a field in my grid, “Notes” every thing works great and my test alert show updateColumn and updateValue value correct!
updaterow: function (rowid, rowdata, commit) {
var updateID = rowid;
var updateColumn = args.datafield;
var updateValue = args.value;
alert(updateID+’ ‘+updateColumn+’ ‘+updateValue);//******* Test *****},
When editing the same field via the setcellvalue my test alert updateColumn and updateValue undefined!
$(“#jqxGrid”).jqxGrid(‘setcellvalue’, 1, “Notes”, “New Value”);updaterow: function (rowid, rowdata, commit) {
var updateID = rowid;
var updateColumn = args.datafield;
var updateValue = args.value;
alert(updateID+’ ‘+updateColumn+’ ‘+updateValue);//******* Test *****},
Hi,
The issue is not in the “setcellvalue” method. In the provided code the “args.datafield” is in the “updaterow” callback because there is no such parameter. There are 3 parameters which you can use in the “updaterow” and these are – rowID – row’s ID, rowData – the row’s data and commit – callback function which you need to call to either confirm or cancel the changes. “setcellvalue” works correctly.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI am using a little different update than normal because I update each cell as changed, not the complete record. To do this I need the RecordID , columnName and columnValue which I get from the rowid, args.datafield and args.value. If you test this it works and I got this information from someone jqWidgets. If there is a better way let me know and I will change my approach.
updaterow: function (rowid, rowdata, commit) {
var updateID = rowid;
var updateColumn = args.datafield;
var updateValue = args.value;
alert(updateID + ‘ ‘ + updateColumn + ‘ ‘ + updateValue);
//$.getScript(“../javascript/gridPDOUpdateRow.js”, function(){ gridUpdateRow(jqxgrid, rowid, updateID, updateColumn, updateValue, valueSelected, rowdata, commit, source.url); });
},I guess the real question I should have asked is when using setcellvalue does it work the same as if you edited a cell’s value? If not is there a way to pass the commit=true or a way to have setcellvalue uses my a custom function?
Hi,
“setcellvalue” is called by the Grid’s editor, too and the logic is the same. However, I should point again that args.datafield and args.value are not parameters of the “updaterow” and you shouldn’t base your logic on these.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comCan you tell me a supported way during the updaterow I can get the ColumnName that was changed. I do not want to update the complete record for one cell….
-
AuthorPosts
You must be logged in to reply to this topic.