easyui 初步学习
1.datagrid 每一行最后列显示添加,修改,删除的按钮:
<th data-options=”field:’operation’,width:80,align:’center’,formatter:Operate”>操作</th>
function Operate(val,row,index){
//console.log( val+”,”+row+”,”+index ); return ‘<a href=”javascript:void(0)” onclick=\”Add(‘+index+’);\”>添加</a> | <a href=”javascript:void(0)” onclick=\”ModifyStrategy(‘+index+’)\”>修改</a> | <a href=”javascript:void(0)” onclick=\”DeleteStrategy(‘+index+’)\”>删除</a>’;
}
2. //格式化时间控件 //格式化时间控件
<td><input class=”easyui-datetimebox” name=”starttime” data-options=”formatter:myformatter,parser:myparser” width=”30″/></td>
function myformatter(date){ var y = date.getFullYear(); var m = date.getMonth()+1; var d = date.getDate(); var h = date.getHours(); var mi = date.getMinutes(); var s = date.getSeconds(); return y+’-‘+m+’-‘+d+” “+h+”:”+mi+”:”+s ; } function myparser(s){ if (!s) return new Date(); var allDay = ( s.split(‘ ‘) ); var ymd = allDay[0]; var hms = allDay[1]; var ss = (ymd.split(‘-‘)); var y = parseInt(ss[0],10); var m = parseInt(ss[1],10); var d = parseInt(ss[2],10); var tt = hms.split(‘:’); var h = parseInt(tt[0],10); var mi = parseInt(tt[1],10); var s = parseInt(tt[2],10); if (!isNaN(y) && !isNaN(m) && !isNaN(d) &&!isNaN(h) && !isNaN(mi) && !isNaN(s) ){ return new Date(y,m-1,d,h, mi, s); } else { return new Date(); } }
3. combox 的切换事件
$(‘#tgTbCb’).combobox({$(‘#TbCb’).combobox({ onChange: function (newValue, oldValue) { $(‘#save’).linkbutton({text:’1′}); var combValue = $(‘#TbCb’).combobox(‘getValue’); if( combValue == “acb” ) { comboIndex = 1; $(‘#save’).linkbutton({text:’2′}); } Show( 4,selectRowIndex ); } });
4。combotree的自动选中事件
$(‘#combtree’).combotree({$(‘#combtree’).combotree({ onClick: function(node){ Show( 4, selectRowIndex ); }, onLoadSuccess:function( node, data ){ $(‘#combtree’).combotree( ‘setValue’, data[0].id); } });
5.防止页面加载出现dialog等其他非主页信息
<div class=”easyui-layout” id=”easyuiLayout” style=”width:90%;height: 750px;visibility: hidden;” >
然后在加载成功之后显示出来:
$(document).ready(function(){
$(‘#easyuiLayout’).css({visibility:”visible”});
}
扫描下方二维码,关注业余草微信公众号,回复“FFmpeg”关键词,获取 FFmpeg 视频教程!