Home › Forums › Guriddo jqGrid JS › Help › How can the key name ‘id’ be changed in saveRow()
I am writing a generic table editor for browsing my database.
Tony,
I was able to achieve my desired result by changing line 122 of grid.inlinedit.js (should that name be inlineedit?) from…
if(tmp) { tmp[“id”] = rowid; ….
to
if(tmp) { tmp[$t.p.jsonReader.id] = rowid; ….
but I don't think this is a real solution as it relies on the presence of the jsonReader object.
Hello,
IMHO this solution is not applicable. One approach is to create a hidden coulmn and post it. Another is to use the extraparam to pass additional data to the post.
See docs
Regards
Tony
The problem is that if I have a table with a column named 'id', that column cannot be edited.
Before edit the row get the id of the column – let say myid, then
myextraparam = {jqGridUIDCol:myid}
$(“#mygrid”).saveRow(myid, false, myurl, myextraparam);
When you post the value from jqgrid use
Hello, Tony!
I do understand what you are saying. I have already used the extra parameters to communicate both the table name and primary column name.
Maybe you should try with the option key:true too, which have higger priority.
I added the { key : true } to my colModel object for my key column giving…
{ name: 'invid', index: 'invid', editable: false, key: true, width: 66, align: 'right' }
… and reran my test with a non-key column named 'id' (not the primary key).
So, I guess option (1) is it.
Stay connected with us in your favorite flavor!
Copyright 2014 TriRand LtdAll Rights ReservedRSS