zoukankan      html  css  js  c++  java
  • EasyUI问题小结(不定期更新·······)

    项目中用到了EasyUI,本人以前也没用过,故记录下来开发过程中遇到的一些问题。

    1.combobox取值赋值的问题

       取值: $("#comID").combobox('getValue');

       赋值: $.post('url',data,function(result){ $("#comID").combobox({  data:result, valueFiled:'id', textFiled:'text',editable:false, }); })

    2.DataGrid问题合集

       (1)列表初始化:

              

     1 $("#grid").datagrid({
     2    loading:'加载中...',//提示信息
     3    '100%',
     4    height:'100%',
     5    pageSize:10,//每页显示条数
     6    pageList:[10,30,50],
     7    nowrap:false,
     8    striped:true,
     9    fitColumns:true,
    10    fit:true,
    11    url:'url',//请求的数据地址
    12    method:'post',
    13    idField:'Id',//数据表的主键
    14    singleSelect:true,//是否为单选
    15    columns:[jsonColumn],//要绑定的字段信息
    16    toolBar:toolBar,//工具栏
    17    pagination:true,//是否分页
    18    rownumbers:true,//是否显示行号
    19    onLoadError:function(){
    20        alert("加载失败!");
    21   }
    22 });

       (2)多选复选框分页后选中保留

    1.当 singleSelect设置为true时,给上面的那些个属性代码加上这两个:
    1 checkOnSelect:false, 2 selectOnCheck:false,
    2.也可以设置 multiple:true
    这两个方法都必须设置idField,并且该值为数据库中真实存在的字段。

       (3)加载后项默认选中

     1 添加一个onLoadSuccess:function(row){
     2           var  rlist=data.split(',');//你要比对的数据值
     3           var  Rows=row.rows;
     4           for(var i=0;i<rlist.length;i++){
     5             $.each(Rows,function(index,item){
     6                   if(item.Id==rlist[i]){
     7                       $("#grid .datagrid-row[datagrid-row-index="+index+"] input[type='checkbox']").attr("checked","checked");
     8                 }
     9             });
    10         }
    11    }

       (4)列表右键菜单功能

     1 添加如下代码:
     2    onRowContenxtMenu:function(e,rowIndex,rowData){
     3        if(rowData!=null){
     4            e.preventDefault();
     5            $(this).datagrid("selectRow",rowIndex);
     6            $("#gird").menu('show',{
     7                   left:e.pageX,
     8                   top:e.pageY
     9            });
    10            e.preventDefault();
    11      }
    12   }

       

  • 相关阅读:
    cocos2dx 11中粒子特效
    对比kCCPositionTypeFree和kCCPositionTypeRelative两种粒子移动类型
    自定义粒子
    求第二大的值
    不使用第三方变量交换两个变量的值
    Sublime Text 2 使用心得
    Linux操作系统和Windows操作系统
    js向左滚动的文字
    数据库的优化
    input输入框默认文字,点击消失
  • 原文地址:https://www.cnblogs.com/ypyhy/p/6530993.html
Copyright © 2011-2022 走看看