Need help adding a subgrid row.
Clicking on the add row submit button the http post is sent to the server.
The add row modal does not close.
What response does the server send to the client?
What if anything needs to be done to add a row on the client side?
Here’s the add row code
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
function showChildGrid(parentRowID, parentRowKey) { var childGridID = parentRowID + "_table"; var childGridPagerID = parentRowID + "_pager"; $('#' + parentRowID).append('<table id=' + childGridID + '></table><div id=' + childGridPagerID + ' class=scroll></div>'); var _officeid = $("#jqGrid").jqGrid("getCell", _rowid, "OfficeID"); var _agentid = $("#jqGrid").jqGrid("getCell", _rowid, "AgentID" ); $("#" + childGridID).jqGrid({ url: 'DataFiles.htm', editurl: 'DataFiles.htm', mtype: "POST", datatype: "json", postData: {oper:'loadsubgrid',mode:'assistant',method:'data',AgentID: _agentid,OfficeID: _officeid}, page: 1, colModel: [ { label: 'pID', name: 'pAgentID', align: "left", width: 300, key: true, index: 'pAgentID', stype:'select', editable: true, edittype:"select", editoptions: { dataUrl: 'DataFiles.htm?oper=loadselect&mode=assistant&method=data&parent_id=' + _rowid + '&OfficeID=' + _officeid + '&AgentID=' + _agentid } }, { label: 'pPersonal Assistant', name: 'pName', align: "left", width: 400 } ], loadonce: true, width: 500, height: '100%', pager: "#" + childGridPagerID//, }); $("#" + childGridID).navGrid("#" + childGridPagerID, { search: false, // show search button on the toolbar add: true, edit: false, del:true, refresh: true }, {}, // edit options { // add options mtype: "POST", onclickSubmit: function(rowid){ _OfficeID = $("#jqGrid").jqGrid("getCell", _rowid, "OfficeID"); var val = $(this ).getCell(rowid, 'pAgentID'); return {oper:'add_subgrid_row',mode:'assistant',method:'data',parent_id:_rowid,OfficeID:_OfficeID }; }, recreateForm:true, closeAfterAdd:true, reloadAfterSubmit:true, modal:true, jqModal:true, viewPagerButtons: true, addCaption: "Add Personal Assistanat", left:250, top: 200 }, { // delete options mtype: "POST", onclickSubmit: function(rowid){ var myGrid = $("#" + childGridID); selRowId = myGrid.jqGrid ('getGridParam', 'selrow'), celValue = myGrid.jqGrid ('getCell', selRowId, 'pAgentID'); _OfficeID = $("#jqGrid").jqGrid("getCell", _rowid, "OfficeID"); _AgentID = $("#jqGrid").jqGrid("getCell", _rowid, "AgentID"); return {oper:'del_subgrid_row',mode:'assistant',method:'data',parent_id:_rowid,AgentID: _AgentID, OfficeID:_OfficeID }; }, beforeShowForm: function(form) { _this_row = jQuery( this ).jqGrid('getGridParam','selrow'); _this_name = $( this ).jqGrid("getCell", _this_row, "pName"); $("td.delmsg",form).html("xDo you really want delete <b>" + _this_name + "</b>?"); }, width:300, addCaption: "Delete Personal Assistanat", left:250, top: 200 }, {} ); } }); |
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top