go to post David Saunders · Sep 8 For now I am skipping trying to get the column widths from the zen page property, columnWidths. I am hard coding the values in the dgRender method. I am using the below to change the column widths but the alerts are showing me that the first 3 columns are set but then dgRender (which is the target of the onrender property of the dynaGrid) is being called again. Not sure why this is happening. ClientMethod dgRender(pGrid) [ Language = javascript ]{ var colWidths = [300,110,110,200,160,60,300,100,50,60]; var dataSet = pGrid.getDataSet(); var maxrows = dataSet.getDimSize(1); var maxcols = dataSet.getDimSize(2); alert('dgRender:\n\n colWidths = ',colWidths); for (var col=0; col<maxcols; col++) { alert('dgRender:\n\n col = '+col+'\n colWidth = '+colWidths[col]); pGrid.setColumnProperty(col, "columnWidth", colWidths[col]); }} Thank you for your time.
go to post David Saunders · Sep 4 Also, is it possible to add a dropbox in the cells in the CoConsultant column to allow user to choose a CoConsultant. The data will be retrieved from a table. And the 'Include' column is to indicate whether the user wants to include the row of data in the data that will be placed in the table. In the documentation I saw a reference to selected row which used a checkbox fair;ly far down on this page; https://docs.intersystems.com/ens201817/csp/docbook/Doc.View.cls?KEY=GZC.... It had a picture of a data grid with checkboxes in the second column. Thank you.
go to post David Saunders · Aug 19 Robert, I finally got this figured out. I posted my complete solution. I use a Zen Page and a Zen standard Dialog. Thanks for your time
go to post David Saunders · Aug 19 I appreciate all the advice I received from members on this post. I want to let all of you know that I finally got it working, including closing the popup. I spent a ton of time working on this. I wanted to share the final solution. I am going to post a generic resolution that I think anyone would be able to make use of. The solution involves using 2 different Zen pages. The parent, which I will name Demo.PopupFileSelectorMain, and the page, or really a defined Zen standardDialog page, which I will name Demo.PopupFileSelector. /// Created using the page template: Title PageClass Demo.PopupFileSelectorMain Extends %ZEN.Component.page{ /// Class name of application this page belongs to.Parameter APPLICATION; /// Displayed name of this page.Parameter PAGENAME; /// Domain used for localization.Parameter DOMAIN; /// This Style block contains page-specific CSS style definitions.XData Style{<style type="text/css">/* style for title bar */#title {background: #C5D6D6;color: black;font-family: Verdana;font-size: 3em;font-weight: bold;padding: 5px;border-bottom: 1px solid black;text-align: center;}/* style for main form buttons */#mfbutton{width: 500px;height: 100px;font-size: 1.5em;}</style>} /// This XML block defines the contents of this page.XData Contents [ XMLNamespace = "http://www.intersystems.com/zen" ]{<page xmlns="http://www.intersystems.com/zen" title="Demo Popup File Selector"><html containerStyle="height:100px;" id="title">Demo Popup File Selector</html><hgroup width="100%"><button caption="Import Demo File" controlStyle="width:500px; height:100px; font-size:1.5em;" onclick="zenPage.showFileSelectDialog();"/></hgroup></page>} ClientMethod showFileSelectDialog() [ Language = javascript ]{ // You can customize the 'Dir' (default directory) and 'wildcard' (file filter) parameters var defDir = "C:\\"; // Start in the default manager directory or specify a path like "C:\\temp" var wildcard = "*.csv, *.txt"; // Filter for text files zenLaunchPopupWindow('Demo.PopupFileSelector.cls', 'Test Popup', 'center=yes,resizable=no,width=400,height=250');} ClientMethod onPopupAction(popupName, action, value) [ Language = javascript ]{ console.log('Popup dialog returned:\n popupName = '+popupName+'\n action = "'+action+'"\n value = '+value); if (value == 'importData') { //zenSetProp('messageLabel', 'value', 'Dialog returned: ' + value);console.log('Made it to onPopupAction:\n value = '+value);zenPage.ProcessFileContent(); }} ClassMethod ProcessFileContent() [ ZenMethod ]{ Set ^UT("Demo.PopupFileSelectorMain","ProcessFileContent")=$HWrite "Made it to frmMain:ProcessFileContent" Quit} } /// Created using the page template: DefaultClass Demo.PopupFileSelector Extends %ZEN.Dialog.standardDialog{ /// This XML block defines the contents of this page.XData dialogBody [ XMLNamespace = "http://www.intersystems.com/zen" ]{<pane title="Choose File"><label value="Choose a file: "/><fileUpload id="chosenFile" accept=".csv,.txt" onchange="zenPage.uploadFile();"/></pane>} /// Override to handle the OK button.ClientMethod getDialogValue() [ Language = javascript ]{return "importData";} /// Override to provide the dialog title.Method %DrawTitle(pSeed As %String) As %Status{Write "<H1><Center>Choose a Client Consultation file.</Center></H1>"Quit $$$OK} ClientMethod uploadFile() [ Language = javascript ]{ // Get the file upload component console.clear(); console.log('made it to uploadFile'); var fileUpload = zenPage.getComponentById('chosenFile'); // Get the selected file //var file = fileUpload.getValue(); // This will return the file object var file = event.target.files[0];console.log('file = ',file); // Check if a file is actually selected if (file) { console.log('About to read file into string'); // If the file is small and you only need the text content var reader = new FileReader(); reader.onload = function(e) {// You can then process the fileContent as needed zenPage.ProcessFileContent(e.target.result); // Pass content as a stringconsole.log("File content:", e.target.result);}; reader.onerror = function(e) {console.error("Error reading file:", event.target.error);}; reader.readAsText(file); // Read as text}} ClassMethod ProcessFileContent(pContent As %String) As %Status [ ZenMethod ]{ // Process pContent on the server&js<console.log('ProcessFileContent');>Write "ProcessFileContent: pContent = "_pContentSet ^UT("Demo.PopupFileSelector","ProcessFileContent","$IO")=$IOSet ^UT("Demo.PopupFileSelector","ProcessFileContent","pContent")=pContent Quit $$$OK} } My hope is that someone finds this usefull.
go to post David Saunders · Aug 15 Robert, not sure why it occured to me just now, but I decided to create a HelloWorld CSP page with an Exit button. It's very simple. I compiled it and then opened it directly. I then clicked the Exit button and it displayed the alert and then closed. I put the script between the upper HTML tag and the HEAD tag in my HelloWorld CSP. So I moved the Script in my upload.csp to between those tags. I am getting the alert for ExitPopup but then I ma also getting the alert for Choose file clicked and the window is not closing. So there is something with CSP script stuff. I am not really very familiar with the CSP Script stuff. So if you have any ideas I would love to hear them. At least I am getting a bit closer.
go to post David Saunders · Aug 15 Yes, I have launched by pressing Web icon in Studio while upload.csp was in focus. But I have also tried by launching the popup using the button on my zen page.
go to post David Saunders · Aug 15 Hey Robert, Thanks for the reply. I did add an Exit button as you suggest, mostly to test window.close() function to close the window, and it does not close the window. I have used this function in the past to close windows and it usually works. But for some reason is not working in this case. I am not sure what is going on here, but that is why I posted it because it is unusual that it is not working.
go to post David Saunders · Aug 12 Thanks for your input, Timo. I checked the Session Timeout in the CSP Default Parameters page. It is set to 300. Is this setting to which you are referring? This is in seconds, correct? So 5 minutes? But I have waited more than 5 minutes after closing any browser tabs on the server, my desktop, which would host things like the application and management portal. Close any Studio and terminal windows. But I am still getting "License limit exceeded." My app is just for me and it would be really helpful if I could access it from my laptop using the IP Adress of my desktop which means I have to be on the same network as the server. I am not interested in being able to access it while away from home.
go to post David Saunders · Aug 1 OK. I found I have to use controlStyle to define the size of the buttons. <button caption="Generate Report" controlStyle="width:500px; height:200px;"/> Thanks