如何绑定的jqGrid行单元格中的下拉列表 [英] How to bind a dropdown list inside jqgrid row cell

查看:1197
本文介绍了如何绑定的jqGrid行单元格中的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的ASP.net MVC应用程序执行的jqGrid。我需要绑定的jqGrid的网格列内的下拉列表。

I am implementing Jqgrid in my ASP.net MVC Application. I need to bind a dropdown list inside a grid column of Jqgrid.

我是不是能找到什么好的固体code参考如何做到这一点..

I was not able to find any good solid code for reference how to do this..

任何一个可以建议如何做this..a完整的示例将是巨大的。

can any one suggest how to do this..a complete example would be great .

推荐答案

尝试使用 <一个href=\"http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3acommon_rules#editoptions\">editoptions

Try using editoptions

 jQuery('#grid').jqGrid({
        autowidth: true,
        autoheight: true,
        url : '',
        mtype : 'POST',
        colNames : [  'ID','State', 'Product'],
        colModel : [ {name : 'id',index : 'id',hidden:true,align:'center'},
                     {name : 'name',index :'name',width:200,
                                            sortable:true,
                                            align:'center',
                                            editable:true,
                                            cellEdit:true,
                                            edittype: 'select', 
                                            formatter: 'select',

                                            editoptions:{value: getAllSelectOptions()}
                     },
                     {name : 'product',index : 'product'},
                   ],
        rowNum : 10,
        sortname : 'name',
        viewrecords : true,
        gridview:true,
        pager : '#pager',
        sortorder : 'desc',
        caption : 'Setup',
        datatype : 'json'
    });


function getAllSelectOptions(){
 var states = { '1': 'Alabama', '2': 'California', '3': 'Florida', 
               '4': 'Hawaii', '5': 'London', '6': 'Oxford' };

  return states;

}

请参阅 href=\"http://stackoverflow.com/questions/13116256/add-dropdown-in-jqgrid-dynamically\">和的点击此处查看全部

这篇关于如何绑定的jqGrid行单元格中的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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