记录easyui-datagrid

默认加载数据及分页加载

$("#about_box").datagrid({
            url : '',
            fitColumns : true,
            nowrap : true,
            striped : true,
            border : false,
            loadMsg : "正在加载中...",
            pagination : true,// 自动分页功能 会自己传递 page rows 参数 后台接口 需要返回toal 及数据rows源
            rownumbers : true,
            singleSelect : true,
            queryParams : {// 额外参数
                vdnId : vdnId,
                // cid : cid,
                custName : custname,
                phone : tel
            },
            toolbar : '#about_search',
            columns : [ [ {
                field : 'ck',
                title : '',
                width : 50,
                align : 'center',
                checkbox : true

            }, {
                field : 'custName',
                title : '姓名',
                width : 150,
                align : 'center'
            }, {
                field : 'phone',
                title : '手机号',
                width : 150,
                align : 'center'
            }, {
                field : 'qq',
                title : 'QQ号',
                width : 150,
                align : 'center'
            }, {
                field : 'wechatNum',
                title : '微信号',
                width : 150,
                align : 'center'
            }, {
                field : 'flymeAccount',
                title : 'flyme账号',
                width : 150,
                align : 'center'
            }, {
                field : 'sex',
                title : '性别',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'custLevel',
                title : 'VIP客户',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'cid',
                title : '客户编号',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'fixedPhone',
                title : '固定电话',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'job',
                title : '职业',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'email',
                title : '邮箱',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'country',
                title : '国家',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'province',
                title : '省份',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'city',
                title : '市级',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'area',
                title : '区级',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'street',
                title : '街道',
                width : 150,
                align : 'center',
                hidden : true
            }, {
                field : 'address',
                title : '详细地址',
                width : 150,
                align : 'center',
                hidden : true
            }, ] ]
        });

有时候希望每次进来都希望数据是空的。可以这样做:

$("#guanlian").unbind('click').click(function() {// 点击关联客户
            $('#about_customer').dialog('open');
            _this.getAboutInfo();
            $('#search_phone').val('');
            //先获取数据
            var item = $('#about_box').datagrid('getRows');  
            console.log(item);
             if (item) {  //有数据再进行重置
                for (var i = item.length - 1; i >= 0; i--) {  
                    var index = $('#about_box').datagrid('getRowIndex', item[i]);  
                    $('#about_box').datagrid('deleteRow', index);  
                }  
            }  
        });
        $('#about_search button').unbind('click').click(function() {// 关联客户搜索
            var search_name = $('#search_name').val();
            var search_phone = $('#search_phone').val();
            var search_cid = $('#info_number').val();
            newCustomerInfo.getAboutInfo(search_cid, search_name, search_phone);

//默认进来没有数据,点击搜索才有数据         $("#about_box").datagrid({'url':'api/customer/getAllCustomer'});
        });
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值