Forum

November 2nd, 2014
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
Formatter Select and JSON data
27/03/2013
02:47
Avatar
Seawinnie
Member
Members
Forum Posts: 3
Member Since:
22/03/2013
sp_UserOfflineSmall Offline

HI,

i have a grid that is populated by JSON data with the last column of the grid (ProjectID) using a select for editing. The select correctly displays the display value in the edit form, however on the grid the id value is displayed.

I have tried setting formatter:'select' on the column but this causes blank values to be displayed rather than the ids. Is there something else I need to do to display the text value in the grid? I am using buildSelect on the column, is this casuing an issue? I have provided my jqgrid data below and have confirmed that valid json data is returned for both the grid and the select.

Any help would be much appreciated. Thanks

$("#list").jqGrid({

url:'HR_GridTemplate_Datahandler.asp?status=GetSkills',

datatype: "json",

colNames:['Id','Skill Name', 'Skill Description','Status','Completion Plus Years','Reminder','Project'],

colModel:[

{name:'Id', index:'Id', key:true, sorttype:'int', hidden: true, editable:false},

{name:'SkillName', index:'SkillName', width:350, editable:true,editoptions:{size:"100",maxlength:"150"}},

{name:'SkillDescription', index:'SkillDescription', width:350, align:'left', editable:true,editoptions:{size:"100",maxlength:"300"}},

{name:'active', index:'active', align:'left', editable:true,edittype:"select", editoptions:{value:"Active:Active;Archive:Archive"}},

{name:'CompletionPlusYears', index:'CompletionPlusYears', editable:true,edittype:"select", editoptions:{value:":;0:0;1:1;1.5:1.5;2:2;2.5:2.5;3:3;3.5:3.5;4:4;4.5:4.5;5:5;6:6;7:7;8:8;9:9;10:10"}},

{name:'Reminder', index:'Reminder', align:'right', editable:true,edittype:"select", editoptions:{value:"Yes:Yes;No:No"}},

{name:'ProjectID', edittype:'select', formatter:'select',

editoptions: { dataUrl:"HR_GridTemplate_Datahandler.asp?status=GetProjects",

buildSelect: function(data)

{

var response = jQuery.parseJSON(data);

var s = '<select>';

jQuery.each(response, function(i, item) {

s += '<option value="'+response[i].id+'">'+response[i].name+'</option>';

});

return s + "</select>";

}

}

}

],

height:'auto',

width: 'auto',

pager: '#skillpager',

rowNum:25,

rowList:[10,25,50,100,200,500],

sortname: 'SkillName',

sortorder: "desc",

// Checkbox to multi select

multiselect: true,

loadonce: true,

jsonReader: {

repeatitems: false,

root: function (obj) { return obj; },

page: function (obj) { return $("#list").jqGrid('getGridParam', 'page'); },

total: function (obj) { return Math.ceil(obj.length / $("#list").jqGrid('getGridParam', 'rowNum')); },

records: function (obj) { return obj.length; }

},

viewrecords: true,

caption: "Skills Grid",

ignoreCase:true,

ondblClickRow: function(rowid) {

jQuery(this).jqGrid('editGridRow', rowid,

{recreateForm:true,closeAfterEdit:true,

closeOnEscape:true,reloadAfterSubmit:false,width:700,top:200,left:200});

}

});

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
50 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