dongshai2022 2015-11-13 21:36 采纳率: 100%
浏览 50

如何在分页时保留jqgrid中的数据?

I have a small and rather simple grid that contains a checkbox on each row. The only function the user can do is check or uncheck the boxes and save the results or exit without saving. The update process works fine if the user clicks the save icon, however if they page, any new selections are lost.

Note: the onSelectRow method does not trigger when the checkbox is clicked so the suggested solutions I have found using that technique do not appear to be applicable.

Thank you for any help you can offer.

Here is the grid code:

$( "#PLlist" ).jqGrid({
        url: "pyg280lload.php?st=" + colPCST + "&sq=" + colPCLSEQ,
        datatype: "json",
        loadComplete : function () {
           $("#gridid").jqGrid('setGridParam',{datatype:'local'});
        },
        mtype: "POST",
        colNames:["Row ID", "Select", "State", "Store#", "Store Name", "Seq#", "Store#"],
        colModel:[{name: "PLROWID", hidden:true},
                  {name: "SELSTR", width:50, align:"center", edittype:'checkbox', formatter: 'checkbox', editoptions: {value:"Y:N"}, editable:true, formatoptions: {disabled : false}},
                  {name: "PCST", width:50, align:"center"},
                  {name: "MTSTOR", width:50, align:"center"},
                  {name: "MTNAME", width:240, align:"left"},
                  {name: "PCLSEQ", hidden:true},
                  {name: "MTLVL4", hidden:true}
                 ],
        pager: "#pagerPL",
        emptyrecords: "No records to display.",
        rowNum: 10,
        rowList: [10, 20, 30],
        sortname: "PLROWID",
        sortorder: "asc",
        sortable: true, 
        viewrecords: true,
        gridview: true,
        autoencode: true, 
        height: "100%",
        caption: "<div id='PLlistCaption'>Select Stores</div>"
    }); 

I am also wanting to save the results of the grid in a temporary table or array for either updating the database or discarding. If the user decides to cancel out I do not want to retain any selections that may have been saved.

This grid is for maintaining a relational file to a parent file. If the user decides not to add the parent record or cancels an update I want to discard the data from this grid, however, if they decide to save the updates or commit the add I want to save the relational data to the database.

Right now I am saving it to the database when the user selects "save", the problem is if they cancel out I now have orphaned data in the secondary table.

Again thank you much for any help.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 我要一个分身加定位两个功能的安卓app
    • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
    • ¥15 IAR程序莫名变量多重定义
    • ¥15 (标签-UDP|关键词-client)
    • ¥15 关于库卡officelite无法与虚拟机通讯的问题
    • ¥15 目标检测项目无法读取视频
    • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
    • ¥100 求采集电商背景音乐的方法
    • ¥15 数学建模竞赛求指导帮助
    • ¥15 STM32控制MAX7219问题求解答