easy-ui 使用总结

1、datagrid 2次加载问题:

解决方案:<table id="DataGrid" class="easyui-datagrid"> 改为 <table id="DataGrid">

只需要在js中初始化datagrid即可

$(function(){
        $('#list_data').datagrid({
            iconCls:'icon-location',//图标 
.................................

 

 

2、window 中表单 ajax提交问题:

            $.ajax({
                cache: true,
                type: "POST",
                url: action,
                data:$('#'+formId).serialize(),// 你的formid
                async: false,
                error: function(request) {
                    alert("Connection error");
                },
                success: function(data) {
                    if(data=='success'){
                        $('#w').window('close');//关闭添加框
                    }
                    if(data=='error'){
                        alertBox('错误信息','菜单添加失败,请稍后再试!','error');
                    }
                }
            });

 

 3、select取值问题

js:

var s = document.getElementById("aa").value;

jquery则是:

var s = $("#aa").val();

用了js框架easyui之后(添加class="easyui-combobox"),就不能这么用了,

你会发现不管怎么取都只能取得第一个option的值,

经过仔细寻查,easyui应该是这样的:

var s = $("#aa").combobox("getValue");

 

4、datagrid

<th field="inDate" width="110" data-options="formatter:dateformater">入货时间</th>
<th field="status" width="110" data-options="formatter:function(val){if(val=='0')return '默认';if(val=='1')return '审核通过';if(val=='1')return '审核不通过';}">状态</th>
<th field="remark" width="110">备注</th>
<th width="110" data-options="field:'_operate',formatter:formatOper">操作</th>

对于时间类型的处理,用formatter

function dateformater(obj){
    var date = obj.year+'-'+(obj.month+1)+'-'+obj.day;
    //var date = obj.year+'-'+(obj.month+1)+'-'+obj.day+' '+obj.hours+':'+obj.minutes+':'+obj.seconds;
    return date;
}

对于固定列eg:操作

field:'_operate'

转载于:https://www.cnblogs.com/superjt/p/3740582.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值