jqgrid下拉列表onclick图标

时间:2015-03-23 12:24:46

标签: javascript jquery jqgrid

我正在尝试在jqgrid的一个单元格中显示下拉列表和一个onClick的铅笔图标(当点击整行变为可编辑时,下拉列表显示在借记卡中) 下图显示了我尝试做的事情

我的方法是我所做的代码 enter image description here

''''''''''''''''''''''''gridfucntion''''''''''''''''''''''''''''''''''''''''

function showMinorityEntryData(){
    alert('minoritydatashow');
    if($("#reportingPeriodId").val()!="" && $("#parentCmp").val()!=""){
        alert('minoritydatashow1111');
    //  $('#masterDiv').show();
         $("#grid").jqGrid({
          datatype: 'json',
          url:'showMinorityData.action?companyId='+companyId+"&parentCmp="+$("#parentCmp").val()+"&reportingPeriodId="+$("#reportingPeriodId").val(),
          mtype: 'GET',
             colNames:['Id', 'GlELEMENTNAME', 'Account Type','Pre-Acq-Amount','Share Amount','Actions'],
             colModel:[
              {name:'id',index:'id', width:55,editable:false,editoptions:{readonly:true,size:10},hidden:false,jsonmap:"minorityId"},
              {name:'glElementName',index:'glElementName', width:100,editable:false, editrules:{required:true}, editoptions:{size:10},jsonmap:"glElementName"},
              {name:'accountType',index:'accountType', width:100,editable:true, editrules:{required:true}, edittype:"select",formatter:'select',editoptions:{ value:  "Debit:Debit;Credit:Credit"},editoptions:{size:10},jsonmap:"acntTypeName"},
              {name:'preAcqAmount',index:'preAcqAmount', width:100,editable:true, editrules:{required:true}, editoptions:{size:10},jsonmap:"preAcqAmt"},
              {name:'shareAmount',index:'shareAmount', width:100,editable:true, editrules:{required:true}, editoptions:{size:10},jsonmap:"shareAmt"},
              {name:'actions',index:'actions', sortable:false,width : 50,align : 'center',formatter:actionIcons}
             ],

             postData: {
          },
             rowNum:20,
             rowList:[10,20,40],
             height: 200,
             autowidth: true,
         //    rownumbers: true,
             pager: '#pager',
             sortname: 'minorityId',
             viewrecords: true,
             sortorder: "asc",
             caption:"Minority Interest",
             emptyrecords: "Empty records",
             loadonce: false,
             loadComplete: function() {
          },
             jsonReader : {
                 root: "rows",
                 page: "page",
                 total: "total",
                 records: "records",
                 repeatitems: false,
                 cell: "cell",
                 id: "minorityId"
             },
             editurl: 'clientArray',
         });    
    }
}

我从此链接http://www.codeproject.com/Articles/610359/JqGrid-Inline-Editing

获取帮助

但是当我在下拉列表中转换accountType单元格时,它不显示帐户类型的类型,下方图片显示了发生的情况enter image description here

当我点击铅笔图标时,整行变得可编辑,但在帐户类型列中,下拉列表不显示任何值

enter image description here

我做错了什么。 jqgrid对我来说是新的

提前致谢

2 个答案:

答案 0 :(得分:1)

您应该包含editoptions或任何其他财产一次。所以

editoptions:{ value:  "Debit:Debit;Credit:Credit"},editoptions:{size:10}

需要更换为

editoptions: { value: "Debit:Debit;Credit:Credit", size:10}

答案 1 :(得分:0)

在代码中你必须写这个 {name:' accountType',index:' accountType',width:100,editable:true,editrules:{required:true},editoptions:{size:10},edittype:& #34;选择",格式化程序:'选择',editoptions:{值:"借记:借记;贷记:信用"},jsonmap:" acntTypeName" }, 这将解决我的要求