您现在的位置:首页 >> 前端 >> 内容

easyui多选框取某个字段值传递到Jfinal后台

时间:2017/3/9 9:14:00 点击:

  核心提示:easyui多选框取某个字段值传递到Jfinal后台,在table中加入多选框 注意:将table中singleSelcet=true 去掉,不然不可以多选。取值 var rows = $(#doct...

easyui多选框取某个字段值传递到Jfinal后台,在table中加入多选框 注意:将table中singleSelcet=true 去掉,不然不可以多选。

取值 var rows = $(‘#doctor_index_dg’).datagrid(‘getSelections’);

ajax传值

var ids = [];
        var rows = $('#doctor_index_dg').datagrid('getSelections');
        if (rows) {
            for (var i = 0; i < rows.length; i++) {
                ids.push(rows[i].uid);
            }
            $.messager.confirm('提示', '确认清楚吗?', function(r) {
                if (r) {
                    console.log(ids);
                    $.post('${base}/doctor/clear', {
                        ids : ids
                    }, function(result) {
                        if (result.code == '12000') {
                            $.messager.show({ // show error message
                                title : '提示',
                                msg : "操作成功"
                            });
                            $('#doctor_index_dg').datagrid('reload'); // reload the user data
                        } else {
                            $.messager.show({ // show error message
                                title : '提示',
                                msg : "操作失败"
                            });
                        }
                    }, 'json');
                }
            });
        }

这时候可以查看ids的数据 console.log(ids) 为[ ]

jfinal在后台取值时,此时需要加上[]取值 即getParaValues(“ids[]”)

通过遍历去执行相应的操作

Tags:EA AS SY YU 
作者:网络 来源:qq_3142624