Expand/collapse P&L nodes works, testing on live deployment

This commit is contained in:
Rick Falkvinge
2012-12-08 13:30:03 +00:00
parent e64a077a10
commit c64ab26bff
2 changed files with 29 additions and 7 deletions
@@ -79,16 +79,17 @@ public partial class Pages_v5_Ledgers_Json_ProfitLossData : System.Web.UI.Page
string element = string.Format("\"id\":{0},\"name\":\"{1}\"", account.Identity,
account.Name.Replace("\"", "'"));
element += string.Format(",\"lastYear\":\"{0:N2} ({1:N2})\"", singleLookups[0][account.Identity],
treeLookups[0][account.Identity]);
element += string.Format(",\"ytd\":\"{0:N2} ({1:N2})\"", singleLookups[5][account.Identity],
treeLookups[5][account.Identity]);
if (treeMap.ContainsKey(account.Identity))
{
element += string.Format(",\"lastYear\":\"<span class=\\\"profitlossdata-collapsed-{0}\\\"><strong>&Sigma;</strong> {1:N2}</span><span class=\\\"profitlossdata-expanded-{0}\\\" style=\\\"display:none\\\">{2:N2}</span>\"", account.Identity, treeLookups[0][account.Identity] / -100.0, singleLookups[0][account.Identity] / -100.0);
element += ",\"state\":\"closed\",\"children\":" + RecurseTreeMap(treeMap, account.Identity);
}
else
{
element += string.Format(",\"lastYear\":\"{0:N2}\"", (double) singleLookups[0][account.Identity] / -100.0);
}
elements.Add("{" + element + "}");
}
@@ -5,12 +5,33 @@
<link rel="stylesheet" type="text/css" href="https://hostedscripts.falkvinge.net/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="https://hostedscripts.falkvinge.net/easyui/themes/default/tree.css"/>
<link rel="stylesheet" type="text/css" href="https://hostedscripts.falkvinge.net/easyui/themes/default/datagrid.css"/>
<script type="text/javascript">
$(document).ready(function () {
$('#tableProfitLoss').treegrid(
{
onBeforeExpand: function (foo) {
$('span.profitlossdata-collapsed-' + foo.id).fadeOut('fast', function () {
$('span.profitlossdata-expanded-' + foo.id).fadeIn('slow');
});
},
onBeforeCollapse: function (foo) {
$('span.profitlossdata-expanded-' + foo.id).fadeOut('fast', function() {
$('span.profitlossdata-collapsed-' + foo.id).fadeIn('slow');
});
}
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<div style="float:right"><asp:DropDownList runat="server" ID="DropYears"/></div>
<h2>P&L for Piratpartiet For Year</h2>
<table id="test" title="" class="easyui-treegrid" style="width:680px;height:600px"
<table id="tableProfitLoss" title="" class="easyui-treegrid" style="width:680px;height:600px"
url="Json-ProfitLossData.aspx"
rownumbers="false"
animate="true"