如何将静态或预定义的下拉列表添加到jqgrid中特定列的所有行? [英] How to add a static or predefined dropdown to all the rows of a particular column in jqgrid ?

查看:129
本文介绍了如何将静态或预定义的下拉列表添加到jqgrid中特定列的所有行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几列可以在表格中说出行动,滚动号码,员工姓名,薪水。



其他栏目如 roll number,员工姓名,工资我将从DB获取值并存储它。但在第一列操作中,我需要为其中的所有行添加默认下拉列表。列表是1.Add,2.Edit,3.remove。



i尝试了各种不适合我的选项。请帮我写一个代码。



我尝试过:



function loadEmployee(){

var options = {'1':'添加','2':'编辑','3':'删除'};

$(#NSC_table ).jqGrid({

url:'servlet / WebFrontServlet?option = inquiry& action = getApproverRec',

colNames:['Action','roll number','员工姓名','薪水'],

colModel:[

{名称:'行动',索引:'行动',宽度:60,可编辑:真,编辑类型:select,formatter:'select',editoptions:{value:options}},

{name:'roll number',index:'prod',align:'left',width: 100},

{名称:'员工姓名',索引:'MBG',对齐: 'center',width:50},

{name:'Salary',index:'WT_site',align:'center',width:70},

rowNum :200,

宽度:'1125',

身高:'自动',

自动宽度:false,

scrollOffset:0,

shrinkToFit:false,

loadonce:true,

sortable:true,



i也尝试将带有编码的值粘贴到editoptions:字段,如下面的行。



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



这两个选项都不起作用。请帮我解释一下代码。在此先感谢。

他们没有抛出错误,但我没有在我的表中下降。我是UI开发的新手,因此不知道会出现什么错误..

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..

推荐答案

(#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' ,宽度:70},

rowNum:200,

宽度:'1125',

身高: 'auto',

autowidth:false,

scrollOffset:0,

shrinkToFit:false,

loadonce: true,

sortable:true,



i也尝试将带有编码的值粘贴到editoptions:字段如下线。



{name:'Action',index:'Action',width:60,editable:true,edittype:select,formatter:'select',editoptions:{value: 1:添加; 2:编辑; 3:删除}}



两个选项都不起作用。请帮我处理代码。在此先感谢。

他们没有抛出错误,但我没有在我的表中下降。我是UI开发新手,因此不知道会出现什么错误。
("#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..


这篇关于如何将静态或预定义的下拉列表添加到jqgrid中特定列的所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆