SmartClient_v101p_2016-02-28_PowerEdition
REPRO steps
============
1. Load the test case
2. Execute exportJSON() in the console
3. Observe JSON is not formatted nicely
This worked in our previous SMartClient release (9.1). I am assuming that if the default behavior was changed, that there is a setting on the grid or JSONEncode that I can set to maintain the formatting (line breaks, indentation).
REPRO steps
============
1. Load the test case
2. Execute exportJSON() in the console
3. Observe JSON is not formatted nicely
This worked in our previous SMartClient release (9.1). I am assuming that if the default behavior was changed, that there is a setting on the grid or JSONEncode that I can set to maintain the formatting (line breaks, indentation).
Code:
<!DOCTYPE html> <html> <head> <title ></title> <style> .diagInfo { font-size: 14px; font-weight: bold; padding: 5px; } </style> <script type="text/javascript" > var isomorphicDir="http://localhost:8080/isomorphic/"; </script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic//system/modules/ISC_Core.js"></script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic//system/modules/ISC_Foundation.js"></script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic//system/modules/ISC_Containers.js"></script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic//system/modules/ISC_Grids.js"></script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic//system/modules/ISC_Forms.js"></script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic//system/modules/ISC_DataBinding.js"></script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic//system/modules/ISC_Drawing.js"></script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic//system/modules/ISC_PluginBridges.js"></script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic//system/modules/ISC_Charts.js"></script> <script type="text/javascript" SRC="http://localhost:8080/isomorphic/skins/EnterpriseBlue/load_skin.js"></script> </head> <body> <script type="text/javascript"> var data = [ { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 56, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 231, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"Staples", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 12, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"Staples", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 12, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"Staples", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 12, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"Staples", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 12, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"Staples", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 12, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"Staples", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 231, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"ABC Drywall Incorporated", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 12, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"Google", building:"Warehouse", inspector: "Josh Burns" }, { project: "123 Avenue", redflag: "", owner: "University of MD", ins: 33, obs: 2, unsafe: 9, safe: 222, insDate: "10/12/2011", score:"<img src='star-4.png'/>55%", score:"<img src='star-4.png'/>55%", link:"<a href=''>View Analysis</a>", company:"Google", building:"Warehouse", inspector: "Josh Burns" } ]; // ===== DO NOT REMOVE ===== var diagLabel = isc.Label.create({ ID: "diagInfo", width: "100%", styleName: "diagInfo", autoFit: true }); // ===== DO NOT REMOVE ===== </script> </head> <body> <script type="text/javascript"> // set this to the correct JIRA ticket var JIRA_TICKET = "SNQA-1170"; // once page loads set some diagnostic information, DO NOT CHANGE isc.Page.setEvent("load", function() { document.title = JIRA_TICKET + " (SmartClient version " + isc.versionNumber + ")"; var html = []; html.push("Jira: " + JIRA_TICKET); html.push("SmartClient: " + isc.versionNumber); html.push("Browser: " + navigator.appCodeName + " " + navigator.appName + " " + navigator.appVersion); diagLabel.setContents( html.join("<br>")); }); isc.DataSource.create({ ID: "ds", cacheData:data, clientOnly: true }); var grid = isc.ListGrid.create({ dataSource : ds, fields: [ {name:"project", title:"Project", type:"text" }, {name:"redflag", type:"text", title:"Flag"}, {name:"owner", type:"text", title:"Owner"}, {name:"ins", type:"integer", title:"#Inspections"}, {name:"obs", type:"integer", title:"#Observations", summaryFunction: function(records, summaryField) { var val = isc.SimpleType.applySummaryFunction(records, summaryField, "sum"); if (typeof (val) != "undefined" && val != null) { var num = new Number(val); num = num.toFixed(2); return num; } else { return "NA"; } } }, {name:"unsafe", type:"integer", title:"# Non-Compliant"}, {name:"safe", type:"integer", title:"# Compliant"}, {name:"insDate", type:"date", title:"Last Inspection"}, {name:"company", type:"text", title:"Company"}, {name:"building", type:"text", title:"Building"}, {name:"inspector", type:"text", title:"Inspector"} ], dataFetchMode : "local", autoFetchData: true, width : 800, align : "center", autoDraw: false, autoFitData : "vertical", autoFitMaxHeight : 600, alternateRecordStyles : true, canAddFormulaFields : true, //canAddSummaryFields : true, canGroupBy : true, //canReorderFields : true, showGroupSummary : true, //groupByMaxRecords : 1000, //canMultiGroup : true, useAdvancedFieldPicker : true, advancedFieldPickerThreshold : 3, canEditTitles: true }); var layout = isc.VLayout.create({ width:"100%", membersMargin: 20, members: [ // ===== DO NOT REMOVE diagLabel diagLabel, // ===== place anty components here grid ] }); var exportJSON = function() { exportOpts = { exportAs : "json", exportDisplay : "download", exportFilename : "test.json" }; grid.exportClientData(exportOpts); } </script> </body> </html>
Comment