I am using JSON to retrieve values โโfor a select element.
my colModel :
{ name: 'position', editable: true, edittype: "select", formatter:'select', editoptions: { value: function() { var positions; $.ajax({ url: "orthofixServices.asmx/GetPositionsList", data: "{}", async: false, success: function(data) { positions = data.d; }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); return positions; }
this is the answer:
{ "d": { "21": "CAP Pos 1", "41": "CAP Pos 2", "42": "CAP Pos 3" } }
And the line sent from the server to snap the grid,
{ "d": { "page": 1, "total": 1, "records": 1, "rows": [ { "id": 9, "name": "Julio", "nameid": 0, "title": "Doctor", "npi": "123-123", "license": "licabc", "licstate": "NV", "position": "41", "us": false, "hrate": 0, "rrate": 0 } ] } }
"position" is a field from a string that passes a select element. After saving the line on the grid, nothing is displayed. What for? Should I save the key from select as Int or as String . Does it matter? I tried both ways so that I could never display anything in the grid for the select element. He should show: "CAP Pos 42"