- Home
- Forum
- ASP.NET MVC
- some questions about data format in treegrid
some questions about data format in treegrid
Attachment: HZ20151021_ebf14bfc.rar
|
Query |
Syncfusion Comment | |
|
1. I set data format for column to show 0 decimal place, but I want some rows in those column to show 1 decimal place. Please see my attached image. For example, I want the numbers in last row of my treegrid to show 1 decimal place(such as in JAN column, I want to it display -65.0), but other rows to show 0 decimal place. |
We can achieve these queries Using “QueryCellInfo” client side event. Find the code snippet below,
| |
|
2. How can we add some characters to the data in treegrid. For example, in my attached image, I want the data in the last row have '%' character, such as in column JAN, -65 should display as -65%. For the data in other rows, I'd like them to be displayed as $9,000. | ||
|
3. I'd like to change the font color based on the data value. For example, in my attached image, I want those negative numbers to display in red color. How can we do that? | ||
|
4. Can we hide the value 0 if the data value is 0? in other words, if the data value is 0, I want that cell be empty without displaying anything. |
We have prepared a sample based on your requirement, find the sample from below location,
Sample: http://www.syncfusion.com/downloads/support/forum/120846/ze/TreeGridQueries-1184730346
Please let us know, if you need further assistance on this.
Regards,
Dinesh kumar.N
We can achieve this by using “QueryCellInfo” client side event, in that we can check whether a cell value is number or not.
Code Snippet:
|
@(Html.EJ().TreeGrid("Tree") .ChildMapping("Children") .TreeColumnIndex(1) .ClientSideEvents(eve => { eve.QueryCellInfo("query"); }) )
<script type="text/javascript"> function query(args) { if (!isNaN(args.cellValue) && args.column.field != "TaskId") args.cellElement.innerHTML =parseInt(args.cellValue).toFixed(2) + "%"; } |
We have prepared a sample based on your requirement, find the sample from below location.
Sample: http://www.syncfusion.com/downloads/support/forum/120846/ze/TreeGrid_Num_Format_Query815773814
Regards,
Dinesh kumar.N
- 4 Replies
- 2 Participants
-
HZ Harry Zheng
- Oct 21, 2015 08:44 PM UTC
- Oct 27, 2015 01:19 PM UTC