Easy-ui常见用法总结

消息提示框:
1. .messager.alert(,,info);2. .messager.alert(‘提示信息’, ‘新增项目失败’, ‘warning’);
通过Id设置不可编辑

var SJSHJG = document.getElementById("SJSHJG");
SJSHJG.disabled = true;
//为datebox设置提前为当前的日期
var date=new Date();
var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0"
+ (date.getMonth() + 1);
var tbrq=date.getFullYear() + '-' + month + '-' + day;
$("#TBRQ").datebox("setValue", tbrq);
var obj = document.getElementById("divPanel");//得到DIV对象
 var e = obj.getElementsByTagName("INPUT");//得到此DIV里的所有INPUT对象
   for (var i=0; ifalse;
                }
//ajax提交表单
$.ajax({ 
       type: "post",
       url:"<%=basePath%>ZYBHBB/SaveBBJBXX.do",
       data:$("#ZYBHBBXXB").serialize(),
       async:false,
       success:function(pd){
         submitForm();
        },
        error:function(e){
         $.messager.alert('提示信息', '新增项目失败', 'warning'); 
        }
});  
  $("#dataView").on("click",function(){
                    var url="<%= basePath%>regulateNav/to_DataView.do";  
                    window.open(url);
            })

    <div id="increaseDialog" class="easyui-dialog"  data-options="headerCls:'titlecls'">div>
$('#increaseDialog').dialog({
            title: '占用补划报备信息表',
            width:$(window).width()-21,
            height:$(window).height()-34,
            left:10,
            top:10,
            zIndex:1000,
            draggable:false,
            resizable:false,
            shadow:false,
            closed: true,
            cache: false,
            href: '<%=basePath%>regulateNav/to_zybh.do',
            modal:false
        });
var toolbar=[{
           text:'更新包数据浏览',
           iconCls:'refeshlook',
           handler:function(){
               debugger;
               var row = $('#tb').datagrid('getSelected');
               if (row){
                   bbbh=row.bbbh;
                   var url="regulateNav/to_DataView.do?bbbh="+bbbh;
                   window.open(url);
               }
               else
               {
                  $.messager.alert('操作提示:','请选择一条信息!',"info") ;
               }
           }
       },{
           text:'日志',
           iconCls:'log',
           handler:function(){
               var row = $('#tb').datagrid('getSelected');
               if (row){
                   var bbbh=row.bbbh;
                   $("#fid").val(bbbh);
                   $('#logDialog').dialog('open');
               }
               else{
                    $.messager.alert('操作提示:','请选择一条信息!',"info") ;
               }
           }
       },{
           text:'申报表单浏览',
           iconCls:'reportlook',
           handler:function(){
               debugger;
               var row = $('#tb').datagrid('getChecked');
               var id = row[0].bbbh;
               var lx = row[0].ywmc;
               if(row.length>1 || row.length<0){
                   $.messager.alert('操作提示:','请选择一条信息!',"info") ;
               }else{
                  if(lx=="占用补划报备"){
                   $("#fid").val(id);
                   $("#LX").val(lx);
                   $("#BJ").val("浏览");
                   $('#increaseDialog').dialog('open');

                  }else{
                      $("#fid").val(id);
                      $("#LX").val(lx);
                      $("#BJ").val("浏览");
                       $('#reduceDialog').dialog('open');
                  }
               }
           }
       }];     
  $(function(){
            $('#tb').datagrid({loadFilter:pagerFilter}).datagrid(); //分页
            $('#tb').datagrid({
                width:'100%',
                height:$(window).height()-$(".condition").height()-80,
                singleSelect:true,
                toolbar:toolbar,
                 url:"ZYBHBB/findFinishBoxList.do",
                fitColumns:true,
                rownumbers:true,
                pagination:true,
                fitColumns:true, 
                 nowrap:false,
                columns:[[
                    {field:'ywmc',title:'业务类别',width:70,align:'center'},
                    {field:'bbbh',title:'报备编号',hidden:'true'},
                    {field:'bbxmmc',title:'报备项目名称',width:70,align:'center'},
                    {field:'szxzqmc',title:'行政区',width:70,align:'center'},
                    {field:'szxzq',title:'行政区',hidden:'true'},
                    {field:'bblx',title:'补划类型',width:70,align:'center'},
                    {field:'dqzt',title:'当前环节',width:70,align:'center'},
                    {field:'tbdw',title:'填报单位',width:70,align:'center'}
                ]]
            });
        });


    //分页
     function pagerFilter(data){
        if( data == null){
            var dg = $(this);
            var pager = dg.datagrid('getPager');
            pager.pagination({   
                    total:0,   
                    pageSize:10   
                });

            }else{
            if (typeof data.length == 'number' && typeof data.splice == 'function'){    // 判断数据是否是数组
                data = {
                    total: data.length,
                    rows: data
                }
             }
             var dg = $(this);
             var opts = dg.datagrid('options');
             var pager = dg.datagrid('getPager');
             pager.pagination({
                 onSelectPage:function(pageNum, pageSize){
                     opts.pageNumber = pageNum;
                     opts.pageSize = pageSize;
                     pager.pagination('refresh',{
                         pageNumber:pageNum,
                         pageSize:pageSize
                     });
                     dg.datagrid('loadData',data);
                 }
             });
             if (!data.originalRows){
                 data.originalRows = (data.rows);
             }
             var start = (opts.pageNumber-1)*parseInt(opts.pageSize);
             var end = start + parseInt(opts.pageSize);
             data.rows = (data.originalRows.slice(start, end));
             return data;
        }
     }

你可能感兴趣的:(easy-ui)