2016-04-20 27 views
0

グリッド内でグリッド内のチェックボックスをクリックすると、マルチ選択チェックボックスがオンになります。ここ は私のグリッドコードです:jqGrid - グリッド内の別のチェックボックスをクリックすると、複数選択チェックボックスがオンになる

var el = jQuery("#GridId"), 
    gridWidth = calculateWidth(null,null,el); 
el.jqGrid({ 
    datatype: 'local' , 
    caption: localeHolder['List_View'], 
    hidegrid : false, 
    mtype : 'POST', 
    autowidth: true, 
    height: calculateHeight(el), 
    width:gridWidth, 
    rowNum: 30, 
    colNames:[localeHolder['T1'],localeHolder['T2'],localeHolder['T3'],localeHolder['T4'],localeHolder['T5']], 
    colModel:[ 
       {name:'t1',index:'t1.id1',searchtype:"String", align:"left",hidden:false,width:calculateWidth(20,gridWidth,null), 
         searchtype:"String", searchoptions:{sopt:['eq','ne','le','lt','gt','ge']}}, 
       {name:'t2',index:'t1.id2',searchtype:"String", sortable:true,width:calculateWidth(30,gridWidth,null), 
         //formatter:function (cellvalue, options, rowObject){ return formatTypeRequiredSpecialCharacterNotAllowedTextBox(options, rowObject,'t2',50,true,"onClickEventOnGrid("+ options.rowId +")");} 
         }, 
       {name:'t3',index:'t1.id3',searchtype:"String", align:"left", sortable:true,width:calculateWidth(60,gridWidth,null), 
         searchtype:"String",searchoptions:{sopt:['cn','bw','ew','eq','ne']}}, 
       {name:'t4',index:'t1.id4', /*align:"center",*/ sortable:true,width:calculateWidth(20,gridWidth,null), 
          formatter:function (cellvalue, options, rowObject){ return formatTypeCheckBox(options, rowObject,'t2',true,"onClickEventOnGrid("+ options.rowId +")");}, 
          searchtype:"String",searchoptions:{sopt:['cn','bw','ew','eq','ne']}}, 
       {name:'t5',index:'t1.id5', /*align:"center",*/ sortable:true,width:calculateWidth(20,gridWidth,null), 
          formatter:function (cellvalue, options, rowObject){ return formatTypeCheckBox(options, rowObject,'t2',true,"onClickEventOnGrid("+ options.rowId +")");}, 
          searchtype:"String",searchoptions:{sopt:['cn','bw','ew','eq','ne']}} 
       ], 
    multiselect: true, 
    pager: '#GridPagerId', 
    sortname: 't1', 
    sortorder: "asc", 
    viewrecords : true, 
    emptyrecords : localeHolder['no_result_found'], 
    loadonce : false, 
    altRows:true, 
    altclass:'altRow', 
    hoverrows: true, 
    ignoreCase: true, 
    gridview: true, 

    onPaging: function(pgButton) { 
     return onPageEventInGrid("GridId","GridPagerId",pgButton); 
    }, 
    beforeSelectRow: function(rowid, e){ 
     return(true); 
    }, 
    onSelectRow:function() { 

     return(true); 
    }, 
    onSortCol: function() { 

    }, 
    beforeRequest : function(){ 

    }, 
    loadComplete : function() { 


    }, 
    loadError : function(error) { 
     openErrorDialog(GRID_ERROR); 
    }, 
    jsonReader : { 
     root : "gridRecords", 
     page : "page", 
     total : "total", 
     records : "records", 
     repeatitems : false, 
     cell : "cell" 
    } 

ので、私はT4またはT5をクリックしたときに。複数選択チェックボックスがオンになりますか?

答えて

0

これは、グリッドのonSelect機能で実行できます。 私はちょうどそのIDを取得する必要があります。

onSelectRow:function(rowId, status, e) { 
     var rowData = $('#GridId').jqGrid ('getRowData', rowId); 
     if($("#xxx_GridId_" + rowId).is(':checked')) { 
      $("#ChkBoxId" + rowData.t2).attr("checked", true); 
     } 
     return(true); 

ここで、xxx_gridId + rowIdは、その複数選択チェックボックスの「id」を組み合わせています。

+0

しかし、まだチェックされますが。データを送信するときにグリッド行が選択されません。誰でもこの問題について知っていますか? – G555

関連する問題