Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have few columns lets say "action", "roll number", "employee name","salary" in a table.

other columns like "roll number", "employee name","salary" i will fetch value from DB and store it. but in the first column "Action" i need to add a default dropdown list for all the rows in it. the list is 1.Add,2.Edit,3.remove.

i tried various options which are not working for me.Please help me write a code for this.

What I have tried:

function loadEmployee(){
var options= { '1': 'Add', '2': 'Edit', '3': 'Remove' };
$("#NSC_table").jqGrid({
url:'servlet/WebFrontServlet?option=inquiry&action=getApproverRec',
colNames:['Action', 'roll number', 'Employee name', 'Salary'],
colModel:[
{name: 'Action', index: 'Action', width: 60, editable: true, edittype: "select", formatter: 'select', editoptions: { value: options } },
{name:'roll number',index:'prod', align:'left', width:100},
{name:'Employee name',index:'MBG', align:'center', width:50},
{name:'Salary',index:'WT_site', align:'center', width:70},
rowNum:200,
width:'1125',
height: 'auto',
autowidth:false,
scrollOffset:0,
shrinkToFit: false,
loadonce: true,
sortable: true,

i also tried pasting the harcoded values to the editoptions: field like below line.

{name: 'Action', index: 'Action', width: 60, editable: true, edittype: "select", formatter: 'select', editoptions: { value: "1:Add;2:Edit;3:remove" } }

Both of the options are not working.Please help me with the code. Thanks in advance.
They are not throwing errors but i didn't get drop down in my Table. i am new to UI developmentso not aware of what will be the mistake..
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900