easyUI中datagrid和treegrid列表按纽重新渲染

easyUI中datagrid和treegrid列表按纽重新渲染
在onLoadSuccess方法中加入以下代码
 $( ' .easyui-linkbutton ' ).linkbutton( {text:'查看',plain:true,iconCls:'icon-view'} );
代码
     /**/ /*
    * 专项任务列表方法业务实现
    
*/

    initSpecWorkPlayList:function()
{        
         var self 
= this;
          self.$_specworkplayList.treegrid(
{
            url: 
this.urls.querySpcialtaskUrl,
            idField:
'id',
            treeField:
'specialTaskName',  //定义树节点的字段
            toolbar: '#workPlayToolbar',
            
//singleSelect: false,
            simpleData:{
                enable: 
true,
                parentField:
"parentId",
                idField:
"id"
            }
,
            columns:[[
                
{field:'specialTaskName',title:'任务名称',width:180,editor:{
                     
"type":"validatebox",
                     
"options":{
                         
"required":true
                     }

                }
,formatter:function(value,row){
                      
return '<span title="'+value+'"  class="easyui-tooltip">'+value+'<span>';
                }
}
,
                
{field:'workContent',title:'任务内容',width:380,formatter:function(value,row){
                      
return '<span title="'+value+'"  class="easyui-tooltip">'+value+'<span>';
                }
}
,    
                
{field:'departmentName',title:'被考核单位',width:100,editor:'text'},
                
{field:'year',title:'考核年',width:100,editor:'text'},
                
{field:'finishTimeString',title:'完成时间',width:100},
                
{field:'finishStatus',title:'状态',width:100,formatter:function(value,row){
                    var status 
= admin.res.dic.getValue("spec_work_finish_status_dic",value);
                    
if (status == null
                        
return "";
                    
else
                        
return '<font color=red>'+status+'</font>';
                }
}
,
                
{field:'cz',title:'操作',width:140,formatter:function(value,row){
                    
if (row.parentId != null &&  row.parentId != "null" && row.parentId != ''{
                       
if (self.finishStatusString == '2'{
                           
return '<span style="color:red"><a href="#" onclick=admin.speccomplete.viewWorkPlayCommpleteWin("'+row.id+'"); class="easyui-linkbutton1" data-options="plain:true,iconCls:\'icon-add\'">查看完成情况</a></span>';
                        }
else {
                           
return '<span style="color:red"><a href="#" onclick=admin.speccomplete.editWorkPlayCommpleteWin("'+row.id+'"); class="easyui-linkbutton2" data-options="plain:true,iconCls:\'icon-edit\'">填写完成情况</a></span>';
                        }

                    }
 else  {
                           self.finishStatusString 
= row.finishStatus;
                           
return '<span style="color:red"><a href="#" onclick=admin.speccomplete.viewSpecAuditDescList("'+row.id+'"); class="easyui-linkbutton3" data-options="plain:true,iconCls:\'icon-add\'">查看意见</a></span>';
                    }

                }
}

            ]],
            onLoadSuccess:function(data)
{  
                $(
'.easyui-linkbutton1').linkbutton({text:'查看完成情况',plain:true,iconCls:'icon-view'});
                $(
'.easyui-linkbutton2').linkbutton({text:'填写完成情况',plain:true,iconCls:'icon-edit'});
                $(
'.easyui-linkbutton3').linkbutton({text:'查看意见',plain:true,iconCls:'icon-view'});
                self.$_specworkplayList.treegrid(
"collapseAll");//树菜单收起来
            }
,
            
//后台需要传入的参数
            queryParams: {
                searchFinishStatus:self.searchstatus,    
                year:self.searchyear,
                specType:
'1'//新建类型
                status1:'4',//任务状态审核通过
                workPlayStauts1:'4',    //查询工作计划审核通过    
                finishStatus1:self.finishStatus1, //完成情况状态为未填写
                finishStatus2:self.finishStatus2, //完成情况状态为待审核状态
                finishStatus3:self.finishStatus3 //完成情况状态为驳回状态
            }

        }
);
    }
,
示例如下:

你可能感兴趣的:(easyUI中datagrid和treegrid列表按纽重新渲染)