This question is locked. New answers and comments are not allowed.
Hi, I have attached an image and will provide my current code at the end.
I have a grid with 2 columns, withdrawals & deposits.
When withdraw amount > 0, then display as currency format with dollar sign, otherwise show empty string. (image label "1")
It is the same for deposit amount. (image label "1")
I can do this with conditional formatting, although I'm losing my currency formatting. (image label "3": format: "${0:N2}")
The biggest issue is that with conditional formatting, when I click on the row headers to sort, the columns are being sorted as strings instead of as numbers. (image label "2")
Is there some syntax that will solve all my issues?
If not, is there some trick where I can keep everything numeric so I can sort, but if the amount is not > 0, then hide the "$0.00" by making the font transparent?
Thanks,
Randy
HTML
JS
I have a grid with 2 columns, withdrawals & deposits.
When withdraw amount > 0, then display as currency format with dollar sign, otherwise show empty string. (image label "1")
It is the same for deposit amount. (image label "1")
I can do this with conditional formatting, although I'm losing my currency formatting. (image label "3": format: "${0:N2}")
The biggest issue is that with conditional formatting, when I click on the row headers to sort, the columns are being sorted as strings instead of as numbers. (image label "2")
Is there some syntax that will solve all my issues?
If not, is there some trick where I can keep everything numeric so I can sort, but if the amount is not > 0, then hide the "$0.00" by making the font transparent?
Thanks,
Randy
HTML
<div id="gridHubSpendAccountActivity" style="height:100%;" data-win-control="Telerik.UI.RadGrid"></div>JS
var hubSpendAccountActivities = new WinJS.Binding.List( [ { activityDate: new Date(2013, 3, 12), description: "ONLINE TEST TWO LINE TRANSFER FROM ACCOUNT NUMBER", withdrawalAmount: "121.34", depositAmount: "" }, { activityDate: new Date(2013, 3, 13), description: "VISA APL*APPLE ITUNES PURCHASE", withdrawalAmount: "34.12", depositAmount: "" }, { activityDate: new Date(2013, 3, 14), description: "MOBILE CHECK DEPOSIT FROM 1234789 XXXX2024567", withdrawalAmount: "", depositAmount: "173.74" }, { activityDate: new Date(2013, 3, 15), description: "CHECK CARD PURCHASE XXXXX1234 APLAPPLE ITUNES STORE PURCHASE XXXXX5674 CA TEST THREE LINE TRANSFER", withdrawalAmount: "5.99", depositAmount: "" }, { activityDate: new Date(2013, 3, 16), description: "ARCH DEBIT XXXXX123 TARGET DEBIT CRD ACH TRAN ABC XYZ", withdrawalAmount: "3.99", depositAmount: "" }, { activityDate: new Date(2013, 3, 17), description: "CHECK CARD PURCHASE XXXXXXX8023 SAVE THE CHILDREN XXXXX123 CT", withdrawalAmount: "354.87", depositAmount: "" }, { activityDate: new Date(2013, 3, 18), description: "ATM DEPOSIT FROM THIS ATM MAXXXX92FHHG123 FIFTH AVE", withdrawalAmount: "", depositAmount: "50" }, { activityDate: new Date(2013, 3, 19), description: "CHECK CARD PURCHASE XXXXXX8789 BAGEL FACTORY LUNCH MEAL", withdrawalAmount: "154.45", depositAmount: "" }, { activityDate: new Date(2013, 3, 20), description: "ONLINE TEST XX1234", withdrawalAmount: "79.85", depositAmount: "" } ] );var gridHubSpendAccountActivity = new Telerik.UI.RadGrid(document.getElementById("gridHubSpendAccountActivity"), { dataSource: hubSpendAccountActivities, schema: { model: { fields: { activityDate: { type: "date" }, description: { type: "string" }, withdrawalAmount: { type: "number" }, amount: { type: "number" } } } }, columns: [ { field: "activityDate", title: "Date", format: "{0:MMM dd}", width: "13%" }, { field: "description", title: "Description", width: "55%", sortable: false }, { field: "withdrawalAmount", title: "Withdrawals", format: "{0:N2}", width: "16%", template: "#=withdrawalAmount > 0 ? '$' + withdrawalAmount : ''#" }, { field: "depositAmount", title: "Deposits", format: "{0:N2}", width: "16%", template: "#=depositAmount > 0 ? '$' + depositAmount : ''#" } ], sortable: "single, allowUnsort", selectable: "none", filterable: false, groupable: false, reorderable: false, resizable: false});