// ----------------------------------------------------------- // hdfdGridLoad: // ---------------------------------------------------------- function hdfdGridLoad(registry, mainTabDomNodeId, mainContentPane) { require(["dijit/layout/ContentPane", "dojo/dom","dojo/dom-style", "dojo/dom-construct", "dojox/widget/Standby"], function(ContentPane, dom, domStyle, domConstruct, Standby){ // dgrid ContentPane var dgridDomOuterId = mainTabDomNodeId + "_dgrid"; var dgridDomInnerId = mainTabDomNodeId + "_dgrid_inner"; if (registry.byId(dgridDomInnerId)) { registry.byId(dgridDomInnerId).destroyRecursive(false); } domStyle.set(dom.byId(dgridDomOuterId), "height", mainContentPane.area.dgridCalcOuterPx); domStyle.set(dom.byId(dgridDomOuterId), "width", "100%"); var dgridDomStandbyId = dgridDomOuterId + "_standby"; registry.byId(dgridDomStandbyId).show(); var dgridDomInnerNode = domConstruct.create("div", {id: dgridDomInnerId}); domConstruct.place(dgridDomInnerNode, dgridDomOuterId, "first"); var dgridPane = new ContentPane({ id: dgridDomInnerId, }, dgridDomInnerId); domStyle.set(dom.byId(dgridDomInnerId), "height", mainContentPane.area.dgridCalcInnerPx); domStyle.set(dom.byId(dgridDomInnerId), "width", "99.5%"); hdfdGridData(registry, dgridDomInnerId, dgridDomStandbyId); }); return; } // ----------------------------------------------------------- // hdfdGridColumnSets_a: // ---------------------------------------------------------- function hdfdGridColumnSets_a() { require(["dojo/dom", "dojo/query","dojo/dom-style"], function(dom, query, domStyle){ //alert ("hdfdGridColumnSets colsets - Check Console 1"); for (var i = 0; i < hjsonGridControl.colsets.length; i++) { //console.log("...hdfdGridColumnSets hjsonGridControl.colsets[i]: ", hjsonGridControl.colsets[i]); switch (i) { case 0: hdfdGridColumnSetAttr(hjsonGridControl.colsets[i], "0"); break; case 1: hdfdGridColumnSetAttr(hjsonGridControl.colsets[i], "1"); break; case 2: hdfdGridColumnSetAttr(hjsonGridControl.colsets[i], "2"); break; case 3: hdfdGridColumnSetAttr(hjsonGridControl.colsets[i], "3"); break; case 4: hdfdGridColumnSetAttr(hjsonGridControl.colsets[i], "4"); break; case 5: hdfdGridColumnSetAttr(hjsonGridControl.colsets[i], "5"); break; } } //alert ("hdfdGridColumnSets colsets - Check Console 2"); }); return; } // ----------------------------------------------------------- // hdfdGridColumnSetAttr: // ---------------------------------------------------------- function hdfdGridColumnSetAttr(colsetAttr, iChar) { var classTD = "td.dgrid-column-set-cell.dgrid-column-set-" + iChar; var classTH = "th.dgrid-column-set-cell.dgrid-column-set-" + iChar; var styleTD = colsetAttr; var styleTH = colsetAttr; require(["dojo/dom", "dojo/query", "dojo/dom-geometry", "dojo/dom-style"], function(dom, query, domGeom, domStyle){ dojo.query(classTD).style(styleTD); dojo.query(classTH).style(styleTH); }); return; } // ----------------------------------------------------------- // hdfdGridColumnSets_s: // ---------------------------------------------------------- function hdfdGridColumnSets_s() { require(["dojo/dom", "dojo/query","dojo/dom-style"], function(dom, query, domStyle){ //alert ("hdfdGridColumnSets colsets - Check Console 1"); for (var i = 0; i < hjsonGridControl.colsets.length; i++) { //console.log("...hdfdGridColumnSets hjsonGridControl.colsets[i]: ", hjsonGridControl.colsets[i]); switch (i) { case 0: hdfdGridColumnSetScroll(hjsonGridControl.colsets[i], "0"); break; case 1: hdfdGridColumnSetScroll(hjsonGridControl.colsets[i], "1"); break; case 2: hdfdGridColumnSetScroll(hjsonGridControl.colsets[i], "2"); break; case 3: hdfdGridColumnSetScroll(hjsonGridControl.colsets[i], "3"); break; case 4: hdfdGridColumnSetScroll(hjsonGridControl.colsets[i], "4"); break; case 5: hdfdGridColumnSetScroll(hjsonGridControl.colsets[i], "5"); break; } } //alert ("hdfdGridColumnSets colsets - Check Console 2"); }); return; } // ----------------------------------------------------------- // hdfdGridColumnSetScroll: // ---------------------------------------------------------- function hdfdGridColumnSetScroll(colsetAttr, iChar) { var classScroll = "div.dgrid-column-set-scroller.dgrid-column-set-scroller-" + iChar; require(["dojo/dom", "dojo/query", "dojo/dom-geometry", "dojo/dom-style"], function(dom, query, domGeom, domStyle){ var scrollDomNode = query(classScroll); //console.log("hdfdGridColumnSetScroll scrollDomNode: ", scrollDomNode); var scrollStyle = domStyle.get(scrollDomNode); //console.log("hdfdGridColumnSetScroll scrollStyle: ", scrollStyle); var width = domStyle.get(scrollDomNode, "width"); //console.log("hdfdGridColumnSetScroll width: ", width); //console.log("hdfdGridColumnSetScroll hjsonGridControl.client: ", hjsonGridControl.client); }); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfdGridData(registry, gridDomNodeId, dgridDomStandbyId) { var urlString = hugmarSettings.host.ifsgridpath; dojo.xhrGet({ url: urlString, load: function(response, ioArgs) { hdfdGridDataRsp(registry, gridDomNodeId, dgridDomStandbyId, response); return response; }, error: function(response, ioArgs) { console.log("hdfdGridData faild xhrGet", response, ioArgs); /* handle the error */ return response; } }); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfdGridDataRsp(registry, gridDomNodeId, dgridDomStandbyId, response) { require(["dojo/ready", "dojo/_base/json"], function(ready, dojo){ ready(function(){ var jsonGridData = dojo.fromJson(response); dojo.xhrGet({ url: hugmarSettings.host.ifscolpath, load: function(response, ioArgs) { hdfdGridRender(registry, jsonGridData, gridDomNodeId, dgridDomStandbyId, response); return response; }, error: function(response, ioArgs) { console.log("hdfTopCtl faild xhrGet", response, ioArgs); /* handle the error */ return response; } }); }); }); return; } // ----------------------------------------------------------- // hdfdGridRender: // ---------------------------------------------------------- function hdfdGridRender(registry, jsonGridData, gridDomNodeId, dgridDomStandbyId, gridColString) { //console.log("hdfdGridLoad gridColString: ", gridColString); require(["dgrid//List", "dgrid/OnDemandGrid", "dgrid/Selection", "dgrid/Keyboard", "dgrid/selector", "dgrid/Editor", "dgrid/ColumnSet", "dgrid/extensions/ColumnHider", "dgrid/extensions/ColumnResizer", "dstore/Memory", "dstore/Trackable", "dijit/form/CheckBox", "dijit/form/DateTextBox", "dijit/form/TimeTextBox", "dijit/form/Select", "dijit/form/FilteringSelect", "dijit/form/ComboBox", "dijit/form/Textarea", "dijit/form/TextBox", "dijit/form/NumberTextBox", "dijit/form/NumberSpinner", "dijit/form/Button", "dijit/ProgressBar", "dojo/store/Memory", "dojo/store/Observable", "dojo/data/ObjectStore", "dojo/has", "dojo/_base/declare", "dojo/dom-style", "dojo/dom-attr", "dojo/number", "dgrid/extensions/DijitRegistry", "dojo/domReady!"], function(List, Grid, Selection, Keyboard, selector, Editor, ColumnSet, ColumnHider, ColumnResizer, Memory, Trackable, CheckBox, DateTextBox, TimeTextBox, Select, FilteringSelect, ComboBox, Textarea, TextBox, NumberTextBox, NumberSpinner, Button, ProgressBar, DojoMemory, Observable, ObjectStore, has, declare, domStyle, domAttr, number, DijitRegistry){ //var dgridDataStore = Observable(new Memory({data: jsonGridData})); var dgridCol = eval ("(" + gridColString + ")"); var TrackableMemory = declare([Memory, Trackable]); dStoreData = new TrackableMemory({ data: jsonGridData, idProperty: 'id' }); registry.byId(dgridDomStandbyId).hide(); if (hjsonGridControl.env.columnsets == true) { var grid = new (declare([Grid, Selection, Keyboard, Editor, ColumnSet, ColumnResizer]))({ collection: dStoreData, columnSets: dgridCol, selectionMode: "single", loadingMessage: "Loading Data...", noDataMessage: "No results found." }, gridDomNodeId); } else { var grid = new (declare([Grid, Selection, Keyboard, Editor, ColumnResizer]))({ collection: dStoreData, columns: dgridCol, selectionMode: "single", loadingMessage: "Loading Data...", noDataMessage: "No results found." }, gridDomNodeId); } hdfdGridOn(grid, dgridCol); if (hjsonGridControl.colsets) { if (hjsonGridControl.colsets.length > 0) { hdfdGridColumnSets_a(); hdfdGridColumnSets_s(); } } }); return; } // ----------------------------------------------------------- // hdfdGridOn: // ---------------------------------------------------------- function hdfdGridOn(grid, dgridCol) { require(["dojo/_base/lang"], function(lang){ var dgridEnv = lang.clone(hjsonGridControl.env); var dgridMenu = lang.clone(hjsonGridControl.contextmenu); // ---------------------------------------------------------------- grid.on("dgrid-datachange", function(evt){ console.log("data changed: ", evt.oldValue, " -> ", evt.value); console.log("cell: ", evt.cell, evt.cell.row.id); hdfdGridEditGo(dgridEnv, evt.cell, evt.value); }); // ---------------------------------------------------------------- grid.on(".dgrid-row:contextmenu", function(evt){ evt.preventDefault(); // prevent default browser context menu var selectedRow = grid.row(evt).data; var cellId = grid.row(evt).element.id; //console.log("contextmenu: selectedRow ", selectedRow); //console.log("contextmenu: dgridEnv ", dgridEnv); //console.log("contextmenu: dgridMenu ", dgridMenu); hdfdGridMenu(evt, selectedRow, dgridEnv, dgridMenu); // item is the store item }); // ---------------------------------------------------------------- // Click on Row used for Button grid.on(".dgrid-row .dgrid-cell:click", function(evt){ evt.preventDefault(); // prevent default browser context menu //console.log("cell clicked: evt.srcElement.type ", evt.srcElement.type); //console.log("cell clicked: evt.srcElement.value ", evt.srcElement.value); if (evt.srcElement.type != "button") { return; } if (evt.srcElement.value === "off") { return; } var selectedRow = grid.cell(evt).row.data; var selectedColumn = grid.cell(evt).column; //console.log("cell clicked: selectedRow ", selectedRow); //console.log("cell clicked: selectedColumn ", selectedColumn); hdfdGridEditButton(dgridEnv, selectedRow, selectedColumn); }); // ---------------------------------------------------------------- // Experiments grid.on(".dgrid-header .dgrid-cell:click", function(evt){ var cell = grid.cell(evt); // cell.element == the element with the dgrid-cell class // cell.column == the column definition object for the column the cell is within console.log("grid.on .dgrid-header .dgrid-cell:click cell.element: ", cell.element); console.log("grid.on .dgrid-header .dgrid-cell:click cell.column: ", cell.column); }); // ---------------------------------------------------------------- grid.on(".dgrid-header .dgrid-cell:contextmenu", function(evt){ var cell = grid.cell(evt); evt.preventDefault(); // prevent default browser context menu // cell.element == the element with the dgrid-cell class // cell.column == the column definition object for the column the cell is within // cell.row == the same object obtained from grid.row(evt) console.log("grid.on .dgrid-header .dgrid-cell:contextmenu cell.column: ", cell.column); console.log("grid.on .dgrid-header .dgrid-cell:contextmenu hjsonGridControl: ", hjsonGridControl); if (hjsonGridControl.env.cltype != "RPGILE") { hdfdGridHeadersGo(); } /* if (hjsonGridControl.env.cltype == "RPGILE") { hdfdGridHdrContextRpg(cell.column.id, dgridCol); } else { hdfdGridHdrContextRpg(cell.column.id, dgridCol); //hdfdGridHdrClickStd(cell.column); } */ }); // ---------------------------------------------------------------- grid.on("dgrid-columnresize", function(evt){ var evtGrid = evt.grid; console.log("grid.on columnresize evtGrid: ", evtGrid); var columnId = evt.columnId; console.log("grid.on columnresize columnId: ", columnId); var width = evt.width; console.log("grid.on columnresize width: ", width); var parentType = evt.parentType; console.log("grid.on columnresize parentType: ", parentType); }); }); return; } // ----------------------------------------------------------- // Context Menu Experiment // ----------------------------------------------------------- function hdfdGridMenu(evt, selectedRow, dgridEnv, dgridMenu) { require(["dijit/Menu", "dijit/MenuItem", "dijit/registry", "dojo/dom", "dojo/dom-construct", "dojo/domReady!"], function(Menu, MenuItem, registry, dom, domConstruct){ var menuNode = domConstruct.create("div", {id: "hdmContextMenu_" + dgridEnv.tab}); var contextMenu; contextMenu = new Menu({ targetNodeIds: [menuNode] }); for (var i = 0; i < dgridMenu.length; i++) { contextMenu.addChild(new MenuItem({ label: dgridMenu[i].cap, iconClass: dgridMenu[i].icon, toolparm: dgridMenu[i].parm, onClick: function(evt) { for (var j = 0; j < dgridMenu.length; j++) { if (dgridMenu[j].cap == evt.target.innerHTML) { if (dgridMenu[j].idx == "SQL") { //console.log("hdfdGridMenu Selected SQL: ", evt.target.innerHTML); hdfdGridMenuSqlDrill(registry, dom, j, selectedRow, dgridEnv, dgridMenu); } else { //console.log("hdfdGridMenu Selected Item: ", evt.target.innerHTML); hdfdGridMenuGo(registry, dom, j, selectedRow, dgridEnv, dgridMenu); } return; } } console.log("hdfdGridMenu evt onClick: ", evt); alert ("Context Menu"); } })); } contextMenu.startup(); dojo.connect(contextMenu, 'onClose', function() { contextMenu.uninitialize(); }); contextMenu._openMyself(evt); // spot of bother return; }); } // ----------------------------------------------------------- // hdfdGridMenuGo: Select Menu Option from Context Menu // ----------------------------------------------------------- function hdfdGridMenuGo(registry, dom, idx, selectedRow, dgridEnv, dgridMenu) { //console.log("hdfdGridMenuGo selectedRow: ", selectedRow); //console.log("hdfdGridMenuGo dgridEnv: ", dgridEnv); //console.log("hdfdGridMenuGo dgridMenu: ", dgridMenu); var jsCaller = "hdfdGridMenuGo"; var docId = "EB1_Parms"; if (dgridEnv.origin === "hugmar") { var procId = 'ContextMenu'; } else { var procId = dgridEnv.ilepgm; } var jsonObj = {}; switch (dgridMenu[idx].func) { case '*CUSTOM': jsonObj = hdfiServerSetJsonObj(jsCaller,"HWEBV2MD","HWEBV2MD"); break; case 'iProgram': jsonObj = hdfiServerSetJsonObj(jsCaller, procId, docId); break; default: jsonObj = hdfiServerSetJsonObj(jsCaller, procId, docId); } jsonObj.gridenv = dgridEnv; jsonObj.gridenv.gridheight = "100"; jsonObj.gridenv.gridwidth = "100"; if (selectedRow.id) { jsonObj.gridenv.rowno = selectedRow.id; // Custom id is zero based } else { jsonObj.gridenv.rowno = selectedRow.rrn; // Hugmar rrn is one based } jsonObj.gridmenu = dgridMenu[idx]; jsonObj.procparm = jsonObj.gridmenu.type; jsonObj.gridrow = {}; jsonObj.gridrow.id = jsonObj.gridenv.rowno; if (selectedRow.rrn) { jsonObj.gridrow.rrn = selectedRow.rrn; } jsonObj.gridrow.zzfiller = " "; //console.log("hdfdGridMenuGo jsonObj: ", jsonObj); require(["dojo/ready", "dojo/_base/json"], function(ready, dojo){ var jsonUrl = hugmarSettings.host.pgmdir + "/hwebhtp120.pgm?json=" + dojo.toJson(jsonObj); console.log("hdfdGridMenuGo dgridMenu[idx]: ", dgridMenu[idx]); // Maint Old Style if (dgridMenu[idx].type == "maint") { hdfdEdit(jsonUrl); return; } // Context Newer var thisFunc = dgridMenu[idx].func; if (dgridMenu[idx].type == "context") { if (thisFunc == "Create" || thisFunc == "Change" || thisFunc == "Copy" || thisFunc == "Delete") { hdfdEdit(jsonUrl); return; } } // Dialog both from context and tools if (thisFunc.substring(0,6) == "Dialog") { hdfdEdit(jsonUrl); return; } // Default hdfiServerGet(jsCaller, jsonUrl); }); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfdGridMenuRsp(registry, dom, response) { console.log("hdfdGridMenuRsp response: ", response); if (response.msgtype == "JSONGRID") { hugmarSettings.host.ifsctlpath = response.ifsctlpath; hugmarSettings.host.ifscolpath = response.ifscolpath; hugmarSettings.host.ifsgridpath = response.ifsgridpath; hugmarSettings.host.ifshdrpath = response.ifshdrpath; hugmarSettings.host.ifshtmlpath = response.ifshtmlpath; hdfTopCtl(registry, dom); return; } // Needs further work rspText = response; var rspArray = rspText.split('~'); var elemCnt = rspArray.length / 2; var tempSev = null; var j = 0; var k = 1; for (var i=0; i" + "
" + "
" + "
" + "
" + "
" + ""; if (dijit.byId("hdmGridColHdrDialog")) { dijit.byId("hdmGridColHdrDialog").destroyRecursive(false); } var colHdrDialog = new dijit.Dialog({ title: "Column Attributes: ", id: "hdmGridColHdrDialog", style: "height: 300px; width: 80%", content: colHdrContent }); colHdrDialog.show(); // Form Heading dojo.addClass("hdmGridColHdrHeading","gridHdrInfoHeading"); dojo.byId("hdmGridColHdrHeading").innerHTML = "Column: " + hjsonCol.label; hdfdGridHdrButtons(); //console.log("hdfdGridHdrClickRpg(2) hjsonCol.filt1: ", hjsonCol.filt1); if (typeof hjsonCol.filt1 === "undefined") {return}; //console.log("hdfdGridHdrClickRpg(3) hjsonCol: ", hjsonCol); // Filter 1 (From) dojo.addClass("hdmGridColHdrFilt1Label","gridHdrInfoLabel"); dojo.byId("hdmGridColHdrFilt1Label").innerHTML = "Filter From"; if (dijit.byId("hdmGridColHdrFilt1")) { dijit.byId("hdmGridColHdrFilt1").destroyRecursive(false); } var dgridColHdrFilt1 = new dijit.form.TextBox({ value: hjsonCol.filt1, id: "hdmGridColHdrFilt1", style: "width:100px", onChange: function(evt) { hjsonCol.filt1 = dgridColHdrFilt1.get("value"); return; } }, "hdmGridColHdrFilt1"); // Filter 2 (To) dojo.addClass("hdmGridColHdrFilt2Label","gridHdrInfoLabel"); dojo.byId("hdmGridColHdrFilt2Label").innerHTML = "Filter To"; if (dijit.byId("hdmGridColHdrFilt2")) { dijit.byId("hdmGridColHdrFilt2").destroyRecursive(false); } var dgridColHdrFilt2 = new dijit.form.TextBox({ value: hjsonCol.filt2, id: "hdmGridColHdrFilt2", style: "width:100px", onChange: function(evt) { hjsonCol.filt2 = dgridColHdrFilt2.get("value"); return; } }, "hdmGridColHdrFilt2"); return; } // ----------------------------------------------------------- // hdfdGridHdrClickStd: // ----------------------------------------------------------- function hdfdGridHdrClickStd(evt, hjsonCol) { for (var i=0; i" + "
" + "
" + "
" + "
" + "
" + "
" + "
" + "
" + "
" + "
" + "
" + "
" + "
" + "
"; if (dijit.byId("hdmGridColHdrDialog")) { dijit.byId("hdmGridColHdrDialog").destroyRecursive(false); } var colHdrDialog = new dijit.Dialog({ title: "Column Attributes: ", id: "hdmGridColHdrDialog", style: "width: 400px", content: colHdrContent}); colHdrDialog.show(); // Form Heading dojo.addClass("hdmGridColHdrHeading","gridHdrInfoHeading"); dojo.byId("hdmGridColHdrHeading").innerHTML = evt.target.textContent; // Column Heading 1 dojo.addClass("hdmGridColHdrHdr1Label","gridHdrInfoLabel"); dojo.byId("hdmGridColHdrHdr1Label").innerHTML = "Column Headings"; if (dijit.byId("hdmGridColHdrHdr1")) { dijit.byId("hdmGridColHdrHdr1").destroyRecursive(false); } var dgridColHdrHdr1 = new dijit.form.TextBox({ value: hjsonCol.chd1, id: "hdmGridColHdrHdr1", style: "width:100px", onChange: function(evt) { hjsonCol.chd1 = dgridColHdrHdr1.get("value"); return; } }, "hdmGridColHdrHdr1"); // Column Heading 2 dojo.addClass("hdmGridColHdrHdr2Label","gridHdrInfoLabel"); dojo.byId("hdmGridColHdrHdr2Label").innerHTML = "- - - - - - - - "; if (dijit.byId("hdmGridColHdrHdr2")) { dijit.byId("hdmGridColHdrHdr2").destroyRecursive(false); } var dgridColHdrHdr2 = new dijit.form.TextBox({ value: hjsonCol.chd2, id: "hdmGridColHdrHdr2", style: "width:100px", onChange: function(evt) { hjsonCol.chd2 = dgridColHdrHdr2.get("value"); return; } }, "hdmGridColHdrHdr2"); // Column Heading 3 dojo.addClass("hdmGridColHdrHdr3Label","gridHdrInfoLabel"); dojo.byId("hdmGridColHdrHdr3Label").innerHTML = "- - - - - - - -"; if (dijit.byId("hdmGridColHdrHdr3")) { dijit.byId("hdmGridColHdrHdr3").destroyRecursive(false); } var dgridColHdrHdr3 = new dijit.form.TextBox({ value: hjsonCol.chd3, id: "hdmGridColHdrHdr3", style: "width:100px", onChange: function(evt) { hjsonCol.chd3 = dgridColHdrHdr3.get("value"); return; } }, "hdmGridColHdrHdr3"); hdfdGridHdrButtons(); if (hjsonCol.fldtype == "A") {return}; // Character String if (hjsonCol.fldtype == "D") {return}; // Date if (hjsonCol.fldtype == "T") {return}; // Time if (hjsonCol.fldtype == "Z") {return}; // Time Stamp // Decimal Places dojo.addClass("hdmGridColHdrDecLabel","gridHdrInfoLabel"); dojo.byId("hdmGridColHdrDecLabel").innerHTML = "Decimal Places"; if (dijit.byId("hdmGridColHdrDec")) { dijit.byId("hdmGridColHdrDec").destroyRecursive(false); } var dgridColHdrDec = new dijit.form.NumberSpinner({ value: hjsonCol.dec, smallDelta: 1, constraints: { min: 0, max: 8, places: 0 }, id: "hdmGridColHdrDec", style: "width:100px", onChange: function(evt) { hjsonCol.dec = dgridColHdrDec.get("value"); return; } }, "hdmGridColHdrDec"); // Division Factor dojo.addClass("hdmGridColHdrDivLabel","gridHdrInfoLabel"); dojo.byId("hdmGridColHdrDivLabel").innerHTML = "Division Factor"; if (dijit.byId("hdmGridColHdrDiv")) { dijit.byId("hdmGridColHdrDiv").destroyRecursive(false); } var dgridColHdrDiv = new dijit.form.NumberSpinner({ value: hjsonCol.div, smallDelta: 1, constraints: { min: 0, max: 6, places: 0 }, id: "hdmGridColHdrDiv", style: "width:100px", onChange: function(evt) { hjsonCol.div = dgridColHdrDiv.get("value"); return; } }, "hdmGridColHdrDiv"); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfdGridHdrButtons() { var hdrButton = dijit.byId("hdmGridColHdrBut0"); if (dijit.byId(hdrButton)) { hdrButton.destroyRecursive(true); } var hdrButton = dijit.byId("hdmGridColHdrBut1"); if (dijit.byId(hdrButton)) { hdrButton.destroyRecursive(true); } var parNode = dojo.byId("hdmGridColHdrButtons"); parNode.innerHTML = " "; //console.log("hdfdGridHdrButtons parNode: ", parNode); // Confirm var butNode = document.createElement("span"); butNode.id = "hdmGridColHdrBut0"; parNode.appendChild(butNode); hdfdGridHdrOneBut("hdmGridColHdrBut0", "Confirm", "gif38", "confirm", "Confirm Column Changes"); // Cancel var butNode = document.createElement("span"); butNode.id = "hdmGridColHdrBut1"; parNode.appendChild(butNode); hdfdGridHdrOneBut("hdmGridColHdrBut1", "Cancel", "gif33", "cancel", "Cancel Column Changes"); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfdGridHdrOneBut(domID, label, icon, action, title) { var hdrButton = dijit.byId(domID); if (dijit.byId(hdrButton)) { hdrButton.destroyRecursive(true); } var dom = dojo.byId(domID); var hdrButton = new dijit.form.Button({ label: label, iconClass: icon, jsId: action, onClick: function(evt) { var butNode = dijit.getEnclosingWidget(evt.target); //console.log("hdfdGridHdrOneBut onClick butNode: ", butNode); hdfdGridHdrConfirm(butNode.jsId); }, title: title}, dom); } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfdGridHdrConfirm(actionType) { if (actionType == "cancel") { if (dijit.byId("hdmGridColHdrDialog")) { dijit.byId("hdmGridColHdrDialog").destroyRecursive(false); } return; } var jsCaller = "hdfdGridHdrConfirm"; var jsonObj = {}; switch (hjsonGridControl.env.cltype) { case 'RPGILE': jsonObj = hdfiServerSetJsonObj(jsCaller,"ILEPGM","CE_GridHdrConfirm"); break; default: jsonObj = hdfiServerSetJsonObj(jsCaller,"HWEBV2BG5","BG5_GridHdrConfirm"); } jsonObj.procparm = "colchange"; jsonObj.gridcol = hjsonCol; jsonObj.gridenv = hjsonGridControl.env; jsonObj.gridenv.gridheight = "100"; jsonObj.gridenv.gridwidth = "100"; //console.log("hdfdGridHdrConfirm jsonObj: ", jsonObj); //alert("hdfdGridHdrConfirm Debug jsonObj: Check Console"); var jsonUrl = hugmarSettings.host.pgmdir + "/hwebhtp120.pgm?json=" + dojo.toJson(jsonObj); //console.log("hdfdGridHdrConfirm jsonUrl: ", jsonUrl); //alert("hdfdGridHdrConfirm Debug jsonUrl: Check Console"); hdfiServerGet(jsCaller, jsonUrl); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfdGridHdrConfirmRsp(registry, dom, jsonResponse) { if (dijit.byId("hdmGridColHdrDialog")) { dijit.byId("hdmGridColHdrDialog").destroyRecursive(false); } if (hjsonGridControl.env.cltype == "RPGILE") { hdfAccMenuAppsGoRsp(registry, dom, jsonResponse); // Refresh Grid } else { return; } } // ----------------------------------------------------------- // hdfdGridEditGo: Edit one Cell // ----------------------------------------------------------- function hdfdGridEditGo(dgridEnv, gridCell, newCellValue) { console.log("hdfdGridEditGo gridCell: ", gridCell); require(["dojo/ready", "dojo/json"], function(ready, json){ var jsCaller = "hdfdGridEditGo"; var jsonObj = hdfiServerSetJsonObj(jsCaller,dgridEnv.origin,"dgridedit"); if (dgridEnv.origin == "hugmar") { jsonObj.procid = "dgridEditCell"; } jsonObj.procparm = "dgridedit"; jsonObj.gridenv = dgridEnv; jsonObj.gridenv.gridheight = "100"; jsonObj.gridenv.gridwidth = "100"; jsonObj.gridenv.rowno = gridCell.row.id; if (gridCell.row.data.rrn) { jsonObj.gridenv.rrn = gridCell.row.data.rrn; } jsonObj.gridenv.colname = gridCell.column.field; jsonObj.gridenv.cellvalue = globalModifyCell(newCellValue); jsonObj.gridenv.filler = " "; jsonObj.gridrow = {}; jsonObj.gridrow.id = gridCell.row.data.id; jsonObj.gridrow.rrn = gridCell.row.data.rrn; jsonObj.gridrow.zzfiller = " "; /* console.log("hdfdGridEditGo jsonObj: ", jsonObj); */ var jsonUrl = hugmarSettings.host.pgmdir + "/hwebhtp120.pgm?json=" + json.stringify(jsonObj) hdfiServerGet(jsCaller, jsonUrl); }); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfdGridEditGoRsp(registry, dom, jsonResponse) { console.log("hdfdGridEditGoRsp jsonResponse: ", jsonResponse); if (jsonResponse.errcode == "OK") {return;} if (dijit.byId("hdmdGridEditDialog")) { dijit.byId("hdmdGridEditDialog").destroyRecursive(false); } var editDialog = new dijit.Dialog({ title: jsonResponse.msghdr, id: "hdmdGridEditDialog", style: "width: 300px", content: jsonResponse.errmsg}); editDialog.show(); } // ----------------------------------------------------------- // hdfdGridButtonGo: Execute Button // ----------------------------------------------------------- function hdfdGridEditButton(dgridEnv, selectedRow, selectedColumn) { //console.log("hdfdGridEditButton dgridEnv: ", dgridEnv); //console.log("hdfdGridEditButton selectedRow: ", selectedRow); //console.log("hdfdGridEditButton selectedColumn.field: ", selectedColumn.field); require(["dojo/ready", "dojo/json"], function(ready, json){ var jsCaller = "hdfdGridEditButton"; var jsonObj = hdfiServerSetJsonObj(jsCaller,dgridEnv.origin,"dgriedit"); jsonObj.procid = "dgridEditButton"; jsonObj.procparm = "dgridedit"; jsonObj.gridenv = dgridEnv; jsonObj.gridenv.gridheight = "100"; jsonObj.gridenv.gridwidth = "100"; jsonObj.gridenv.rowno = selectedRow.id; jsonObj.gridenv.rrn = selectedRow.rrn; jsonObj.gridenv.colname = selectedColumn.field; jsonObj.gridenv.cellvalue = " "; jsonObj.gridenv.filler = " "; jsonObj.gridrow = {}; jsonObj.gridrow.id = selectedRow.id; jsonObj.gridrow.rrn = selectedRow.rrn; jsonObj.gridrow.zzfiller = " "; console.log("hdfdGridEditButton jsonObj: ", jsonObj); var jsonUrl = hugmarSettings.host.pgmdir + "/hwebhtp120.pgm?json=" + json.stringify(jsonObj) hdfiServerGet(jsCaller, jsonUrl); }); return; } // ----------------------------------------------------------- // hdfdGridTestFormatter: Create WebLink // ----------------------------------------------------------- function hdfdGridCellFmtWebLink(item){ var image = 'Web"; var newData = image + " " + webLink + " " + onClick + " " + http; //console.log(newData); return newData; } // ----------------------------------------------------------- // hdfdGridCellRender: renderCell test // ----------------------------------------------------------- function hdfdGridCellRender(object, value, cell, options){ var div = document.createElement("div"); div.innerHTML = "Web"; return div; } // --------------------------------------------------------------- // hdfdGridCellNewWindow: Open New Window // --------------------------------------------------------------- function hdfdGridCellNewWindow(windowUrl,windowName, windowFeat) { newWindow = window.open(windowUrl,windowName,windowFeat); if (newWindow != null) { newWindow.focus(); } } // --------------------------------------------------------------- // hdfdGridCellLink: Open Any Document in New Window // --------------------------------------------------------------- function hdfdGridCellLink(windowUrl, windowName) { console.log("hdfdGridCellLink windowUrl: ", windowUrl); console.log("hdfdGridCellLink windowName: ", windowName); newWindow = window.open(windowUrl, windowName," "); if (newWindow != null) { newWindow.focus(); } } // --------------------------------------------------------------- // hdfdGridCellDynjandiHttp // --------------------------------------------------------------- function hdfdGridCellDynjandiHttp(windowUrl) { console.log("...hdfdGridCellDynjandiHttp windowUrl: ", windowUrl); var windowName = "dynjandi-http"; var windowFeat = "menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no"; newWindow = window.open(windowUrl, windowName, windowFeat); if (newWindow != null) { newWindow.focus(); } } // --------------------------------------------------------------- // hdfdGridCellDynjandiMynd // --------------------------------------------------------------- function hdfdGridCellDynjandiMynd(value) { var windowUrl = "https://www.dynjandi.is/wp-content/uploads/products/" + value; console.log("...hdfdGridCellDynjandiMynd windowUrl: ", windowUrl); var windowName = "dynjandi-mynd"; var windowFeat = "menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no"; newWindow = window.open(windowUrl, windowName, windowFeat); if (newWindow != null) { newWindow.focus(); } } // --------------------------------------------------------------- // hdfdGridCellDynjandiStore // --------------------------------------------------------------- function hdfdGridCellDynjandiStore(value) { console.log("...hdfdGridCellDynjandiStore value: ", value); //var windowUrl = "https://www.dynjandi.is/product-category/skor-og-stigvel/"; var windowUrl = "https://www.dynjandi.is/product-category" + value; var windowName = "dynjandi-vefur"; var windowFeat = "menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes"; newWindow = window.open(windowUrl, windowName, windowFeat); if (newWindow != null) { newWindow.focus(); } } // --------------------------------------------------------------- // hdfdGridCellDynjandiProduct // --------------------------------------------------------------- function hdfdGridCellDynjandiProduct(value) { console.log("...hdfdGridGridCellDynjandiProduct value: ", value); var windowUrl = "https://www.dynjandi.is/product/" + value; var windowName = "dynjandi-vefur"; var windowFeat = "menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes"; newWindow = window.open(windowUrl, windowName, windowFeat); if (newWindow != null) { newWindow.focus(); } } // --------------------------------------------------------------- // hdfdGridCellStillingStore // --------------------------------------------------------------- function hdfdGridCellStillingStore(value) { console.log("...hdfdGridGridCellStillingStore value: ", value); var windowUrl = "http://www.stilling.is/vorur/vara/" + value + "/"; //var windowUrl = "http://www.stilling.is/vorur/vara/" + "PH12258DVB1/"; var windowName = "stillingvefur"; var windowFeat = "menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes"; newWindow = window.open(windowUrl, windowName, windowFeat); if (newWindow != null) { newWindow.focus(); } } // --------------------------------------------------------------- // hdfdGridCellVarahlutirIS // --------------------------------------------------------------- function hdfdGridCellVarahlutirIS(value) { console.log("...hdfdGridGridCellVarahlutirIS Value: ", value); var windowUrl = "http://www.varahlutir.is/leita/?q=" + value; var windowName = "varahlutirvefur"; var windowFeat = "menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes"; newWindow = window.open(windowUrl, windowName, windowFeat); if (newWindow != null) { newWindow.focus(); } } // --------------------------------------------------------------- // hdfdGridCellIAppsPath // --------------------------------------------------------------- function hdfdGridCellIAppsPath(value) { //console.log("...hdfdGridGridCellIAppsPath Value: ", value); //console.log("...hdfdGridGridCellIAppsPath hugmarSettings: ", hugmarSettings); var windowUrl = hugmarSettings.host.server + value; var windowName = "IFS Path"; var windowFeat = "menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes, height=600, width=1200"; newWindow = window.open(windowUrl, windowName, windowFeat); if (newWindow != null) { newWindow.focus(); } } //--------------------------------------------------------------- //hdfdGridCellLocalIFS (does not Work) //--------------------------------------------------------------- function hdfdGridCellLocalIFS(value) { console.log("...hdfdGridGridCellIAppsPath Value: ", value); //console.log("...hdfdGridGridCellIAppsPath hugmarSettings: ", hugmarSettings); var windowUrl = "file://///10.20.64.201" + value; var windowName = "IFS Path"; var windowFeat = "menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes, height=600, width=1200"; newWindow = window.open(windowUrl, windowName, windowFeat); if (newWindow != null) { newWindow.focus(); } } //--------------------------------------------------------------- //hdfdGridCellLocalIFS (does not Work) //--------------------------------------------------------------- function hdfdGridCellLocalIFSx(value) { console.log("...hdfdGridGridCellLocalIFS Value: ", value); console.log("...hdfdGridGridCellLocalIFS hugmarSettings: ", hugmarSettings); var inner = '' + 'img'; console.log("...hdfdGridGridCellLocalIFS inner: ", inner); return inner; } //--------------------------------------------------------------- //hdfdGridCellBarcode //--------------------------------------------------------------- function hdfdGridCellBarcode(name, value, node) { console.log("...hdfdGridGridCellBarcode name,value: ", name, ",", value); console.log("...hdfdGridGridCellBarcode node: ", node); return value; }