We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

I can put a sparkline in a childGrid that is on a grid with hierarchy?

Thread ID:

Created:

Updated:

Platform:

Replies:

145389 Jun 19,2019 07:55 PM UTC Jun 20,2019 09:10 AM UTC ASP.NET MVC - EJ 2 1
loading
Tags: Grid
Juan Cruz
Asked On June 19, 2019 07:55 PM UTC

Hello, I am working with a hierarchical grid with 6 levels (only to be informative), but at level 4 there is information that I would like to put in sparklines. I have read your documentation and can put sparklines in a grid (a simple grid), but I would like to know if it can be placed in a hierarchy. I hope you can help me. I thank you in advance.

Attachment: Index_7466c248.rar

Pavithra Subramaniyam [Syncfusion]
Replied On June 20, 2019 09:10 AM UTC

Hi Juan, 
 
Thanks for contacting Syncfusion support. 
 
We have analyzed your requirement. We suggest you to use the “Column template feature” for the child Grid also, and render the sparkline by using the “QueryCellInfo” event of Grid. Based on your requirement, we have prepared a sample for your convenience, please download the sample from the link below, 
 
 
Documentation :  
 
In the below code, we have used the column template for the child Grid and by using the “QueryCellInfo” event handler we have rendered the sparkline for the columns. Please refer the code below, 
 
 
        @{ 
            var ChildGrid = new Syncfusion.EJ2.Grids.Grid() 
            { 
                DataSource = (IEnumerable<object>)ViewBag.dataSource, 
                QueryString = "OrderID", 
                QueryCellInfo = "QueryCellInfo", 
                Columns = new List<Syncfusion.EJ2.Grids.GridColumn> 
                { 
                    ... 
                   new Syncfusion.EJ2.Grids.GridColumn() { HeaderText = "SparkLine", Template="#sparklineTemp", Width = "130", TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left, CustomAttributes=new { @class="customcss"} }, 
                } 
            }; 
        } 
 
<script type="text/javascript"> 
    function QueryCellInfo(args) { 
            if (args.column.headerText == "SparkLine") { 
                var column = new ej.charts.Sparkline({ 
                    height: '50px', 
                    width: '150px', 
                    type: 'Line', 
                    valueType: 'Numeric', 
                    fill: '#3C78EF', 
                    negativePointColor: '#f7a816', 
                    dataSource: getSparkData('column', 1) 
                }); 
                column.appendTo(args.cell.getElementsByTagName("div")[0]);            @*append the sparkline to the div element in the column*@ 
            } 
    } 
    ... 
 
</script> 
<script type="text/x-template" id="sparklineTemp"> 
    <div id="spkline${EmployeeID}" />                      @*set an unique id for this*@ 
</script> 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Pavithra S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon