Forum

July 12th, 2025
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Form Editign Select, ID different from displayed...
26/09/2011
17:25
Avatar
sirshurf
Member
Members
Forum Posts: 43
Member Since:
06/10/2009
sp_UserOfflineSmall Offline

Ok, I dont really know how to call this topic, but here is my problem.

I have a grid made with some data, the grid is created authomaticly using: https://github.com/sirshurf/iphp

Attached example:

   $("#users").jqGrid({"url":"/user/roles","datatype":"json","mtype":"POST","viewrecords":true,
"colModel":[
{"editable":true,"editrules":{"required":true},"name":"role","label":"Role","_objGrid":{},"search":true},
{"editable":true,"editrules":{"required":true},"name":"title","label":"Title","_objGrid":{},"search":true},
{"name":"id_parent","index":"parent_name","label":"Id Parent","stype":"select","search":true,"searchoptions":{"value":":Select;0:1;1:2"},"editable":true,"edittype":"select","editoptions":{"value":":Select;0:1;1:2"},"editrules":{"required":true},"formoptions":[],"_objGrid":{}},
{"editable":true,"edittype":"text","editoptions":{"defaultValue":"99"},"editrules":{"required":true,"number":true},"name":"order","label":"Order","_objGrid":{},"search":true}
],"autowidth":true,"height":"480px","rowNum":20,"rowList":[20,40,60,80,100],"caption":"Users","postData":{"grid":"users"},"editurl":"/user/roles","ondblClickRow":function(rowId, iRow, iCol, e){ if(rowId){ $(this).jqGrid('editGridRow',rowId, {"checkOnSubmit":true,"reloadAfterSubmit":true,"closeAfterAdd":true,"closeAfterEdit":true,"jqModal":false,"closeOnEscape":true,"afterSubmit":function (data, postdata) { try { json = $.parseJSON(data.responseText); if (json.code == "ok"){ return [true,"",""]; } else { if (json.code == "error"){ return [false,json.msg,""]; } else { return [false,"Error Occured",""]; } } } catch (e) { result = data.responseText.split(":"); if ( result[0] != "OK") { if (result[1] != "") { return [false,result[1],""]; } else { return [false,result[0],""]; } } else { return [true,"",""]; } } }}); } },"pager":"users_pager"}); $("#users").navGrid("#users_pager",{"edit":true,"add":true,"del":true}, {"checkOnSubmit":true,"reloadAfterSubmit":true,"closeAfterAdd":true,"closeAfterEdit":true,"jqModal":false,"closeOnEscape":true,"afterSubmit":function (data, postdata) { try { json = $.parseJSON(data.responseText); if (json.code == "ok"){ return [true,"",""]; } else { if (json.code == "error"){ return [false,json.msg,""]; } else { return [false,"Error Occured",""]; } } } catch (e) { result = data.responseText.split(":"); if ( result[0] != "OK") { if (result[1] != "") { return [false,result[1],""]; } else { return [false,result[0],""]; } } else { return [true,"",""]; } } }}, {"checkOnSubmit":true,"reloadAfterSubmit":true,"closeAfterAdd":true,"closeAfterEdit":true,"jqModal":false,"closeOnEscape":true,"afterSubmit":function (data, postdata) { try { json = $.parseJSON(data.responseText); if (json.code == "ok"){ return [true,"",""]; } else { if (json.code == "error"){ return [false,json.msg,""]; } else { return [false,"Error Occured",""]; } } } catch (e) { result = data.responseText.split(":"); if ( result[0] != "OK") { if (result[1] != "") { return [false,result[1],""]; } else { return [false,result[0],""]; } } else { return [true,"",""]; } } }}, {"checkOnSubmit":true,"reloadAfterSubmit":true,"closeAfterAdd":true,"closeAfterEdit":true,"jqModal":false,"closeOnEscape":true,"afterSubmit":function (data, postdata) { try { json = $.parseJSON(data.responseText); if (json.code == "ok"){ return [true,"",""]; } else { if (json.code == "error"){ return [false,json.msg,""]; } else { return [false,"Error Occured",""]; } } } catch (e) { result = data.responseText.split(":"); if ( result[0] != "OK") { if (result[1] != "") { return [false,result[1],""]; } else { return [false,result[0],""]; } } else { return [true,"",""]; } } }}, {}); $("#users").filterToolbar({"stringResult":true});

One of the columns (Id Parent)  is populated from a SQL join and is named as the display column (parent_name) but the index (the submited value) on search and edit is diferent (id_parent).

This works great in Search and Add but… The edit has a problem. The ID of the edit value list (it looks like) needs to be the display value of the column and in my case it's the name value and not the index value.

Any help will be appriciated.

04/10/2011
18:33
Avatar
sirshurf
Member
Members
Forum Posts: 43
Member Since:
06/10/2009
sp_UserOfflineSmall Offline

Is there no help for the problem I have?

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
14 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information