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.