jqgrid 行编辑/单元格selsect 下拉框并运用select2

{name:"untivalue", index:"untivalue",hidden:true,width:0,classes:'untivalue'},

{name:"itemname", index:"itemname", width:100,align:"center",editable: true,edittype:"select", editoptions:{value:  

  function(url){
    var html = ':;';
     ajax.get(url, function(data){

      for(i=0;i<data.length;i++){
        if(i != data.length - 1){
          html += data[i].value + ":" + data[i].name + ";";
        }else{
          html += data[i].value + ":" + data[i].name;
        }

      }

    })
    return html;
   }

, dataEvents:

      function(classes){
        var obj = [
          {
          type: 'change',
          fn: function(e) {
          var $this = this;
          

      function ($this,classes){
        var val = $this.value;
        $($this).closest('td').siblings('td.'+classes+'').html(val).attr('title',val)
      },


          }
          }
         ]
      return obj;
     },

}},

  

//单元格编辑

afterEditCell: function (rowId, cellname, value, iRow, iCol) {   

       bkcsubtable.afterEditCell_select() //应用select2样式

}

//行编辑

onSelectRow : function(rowId,status) {

  jQuery(RecordGrid).jqGrid('editRow', rowId, true); 

  if(status){
    bkcsubtable.afterEditCell_select() ; //应用select2样式
  }

}

posted @ 2018-10-30 16:31  我是一只小蜂农  阅读(3215)  评论(0编辑  收藏  举报