为了账号安全,请及时绑定邮箱和手机立即绑定

设置并使用localStorage在表单编辑期间保留复选框选择

设置并使用localStorage在表单编辑期间保留复选框选择

大话西游666 2021-05-12 14:19:15
我有一个表单,jqGrid用于表单的一部分。本部分显示可以通过复选框选择的用户信息。在审阅页面上,有一个用于编辑表单的选项,在此过程中,我试图保留复选框的选择。我正在尝试为此使用window.localStorage,但是我不确定如何正确设置setItem。我在loadComplete中调用getItem,在这里我的编码也可能不太正确。我现在所拥有的,当用户去编辑时,在jqGrid中选择第一个项目,而不是实际保存的项目。我猜是因为我没有正确设置setItem。谁能提供指导?$.jgrid.gridUnload("#list");myGrid = $("#list").jqGrid({    url: baseURL + '/scripts/get_user_list.php' + urlString,    datatype: "json",    mtype: 'POST',    width: 660,    height: '100%',    pager: '#pager',    rowNum: 10,    rowList: [20, 30, 40, 50, 60],    sortname: 'id',    sortorder: "asc",    viewrecords: true,    multiselect: true,    repeatitems: false,    imgpath: '/scripts/jquery-ui/images',    colNames: ['id', 'Building', 'Company ID', 'Description', 'Individual Name', 'SECCode'],    colModel: [        {name: 'id', index: 'id', jsonmap: 'id', hidden: true, width: 20},        {name: 'Building', index: 'Building', jsonmap: 'Building', hidden: true, width: 20},        {name: 'CompanyId', index: 'CompanyId', jsonmap: 'CompanyId', width: 110},        {name: 'Description', index: 'Description', jsonmap: 'Description', sortable: true, width: 300},        {name: 'IndName', index: 'IndName', jsonmap: 'IndName', width: 200},        {name: 'UsrNum', hidden: true, index: 'UsrNum', jsonmap: 'UsrNum'}    ],    jsonReader: {        repeatitems: false,        root: 'rows',        id: '0',        cell: '',        subgrid: {            root: 'rows',            id: '0',            cell: '',            repeatitems: false        }    },    // subgrid support    subGrid: true,    subGridUrl: baseURL + '/scripts/get_user_list.php' + urlString,    subGridModel: [{        name: ['Date', 'ID'],        params: ['CompanyId'],        align: ['center', 'right'],        width: [150, 80]    }    ],    ondblClickRow: function (id) {        $('#recId').val(id);    },
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 205 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号