easyui多列checkbox-未测试

 $('#grid').datagrid({
              columns:[[
                  {field:'CODE_NM',title:'名称',align:'center',width:'40%'},
                  {field:'a',title:'选项A',width:'15%',align:'center',
                      formatter: function (value, rowData, rowIndex) {
                                  if(value=="1"){
                                      return '<input type="checkbox"  id="a_'+rowIndex+'" />';
                                  }else if(value="0"){
                                      return '<input type="checkbox"   id="a_'+rowIndex+'" checked = "checked"/>';
                                  }
                                
                            }},
                  {field:'b',title:'选项B',width:'15%',align:'center',
                      formatter: function (value, rowData, rowIndex) {
                                  if(value=="1"){
                                       return '<input type="checkbox"  id="b_'+rowIndex+'" />';
                                  }else if(value=="0"){
                                       return '<input type="checkbox"  id="b_'+rowIndex+'" checked="checked"/>';
                                  }
                               
                            }}
              ]],
              width:'100%',
              hight:'100%',
              rownumbers:true,
              title:'列表信息',
              url:"getDetail",
              onClickRow:function(index,row){
                  $('#grid').datagrid('clearSelections');
                  if($('#a_'+index).get(0).checked){
                      row.a = "0";
                  }else{
                      row.a = "1";
                  }
                  if($('#b_'+index).get(0).checked){
                      row.b = "0";
                  }else{
                      row.b = "1";
                  }                  
              },
              dataType:"json",
              type:'post',
              onLoadSuccess:function(data){
              }
          
          }); 

 

posted on 2020-07-23 09:59 青蛙學堂 阅读(168) 评论(0)  编辑 收藏 引用 所属分类: JavaScript

只有注册用户登录后才能发表评论。
<2024年3月>
252627282912
3456789
10111213141516
17181920212223
24252627282930
31123456

导航

统计

常用链接

留言簿(8)

随笔分类

随笔档案

收藏夹

青蛙学堂

最新评论

阅读排行榜

评论排行榜