<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Products &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/products/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 02 Jun 2021 15:16:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Products &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Using MVC Grid In MVC</title>
		<link>https://mail.sibeeshpassion.com/using-mvc-grid-in-mvc/</link>
					<comments>https://mail.sibeeshpassion.com/using-mvc-grid-in-mvc/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Fri, 11 Dec 2015 00:00:15 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC Grid]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Products]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10981</guid>

					<description><![CDATA[In this post we will see how we can develop a MVC grid in our MVC application. There are so many grids are available in the industries, most of them are useful. Here we are going to use a grid called MVC grid, which uses bootstrap and jQuery. We will create some dynamic data using list first, once it is done, we will send this data to the MVC grid. Sounds good? I hope you will like this article. Download Source Code Using MVC Grid In MVC Background I have been working with the Grid controls for a long long [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will see how we can develop a MVC grid in our <a href="http://sibeeshpassion.com/category/mvc/" target="_blank" rel="noopener">MVC </a>application. There are so many grids are available in the industries, most of them are useful. Here we are going to use a grid called MVC grid, which uses bootstrap and <a href="http://sibeeshpassion.com/category/jQuery/" target="_blank" rel="noopener">jQuery</a>. We will create some dynamic data using list first, once it is done, we will send this data to the MVC grid. Sounds good? I hope you will like this article. </p>
<p><strong>Download Source Code</strong></p>
<li><a href="https://code.msdn.microsoft.com/Using-MVC-Grid-In-MVC-4111f300" target="_blank" rel="noopener">Using MVC Grid In MVC</a></li>
<p><strong>Background</strong></p>
<p>I have been working with the Grid controls for a long long time. So far I have worked with jQX Grid, jQ Grid, jQuery Datatables, Pivot tables, KO grid etc. It is always interesting to work with some controls. I always loved it. recently I worked with MVC grid. So I thought of sharing that experience with you all. </p>
<p><strong>Create a MVC application</strong></p>
<p>First, we will start with creating an MVC application. Open your visual studio, then click File->New->Project. Name your project. </p>
<p><strong>Install MVC Grid</strong></p>
<p>The next step we are going to do is, installing the MVC grid to our project. To install, please right click your solution and click on Manage NuGet packages. </p>
<div id="attachment_10982" style="width: 469px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/11/Select_NuGet_Package.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-10982" src="http://sibeeshpassion.com/wp-content/uploads/2015/11/Select_NuGet_Package.png" alt="Select NuGet Package" width="459" height="673" class="size-full wp-image-10982" srcset="/wp-content/uploads/2015/11/Select_NuGet_Package.png 459w, /wp-content/uploads/2015/11/Select_NuGet_Package-205x300.png 205w, /wp-content/uploads/2015/11/Select_NuGet_Package-400x586.png 400w, /wp-content/uploads/2015/11/Select_NuGet_Package-409x600.png 409w" sizes="(max-width: 459px) 100vw, 459px" /></a><p id="caption-attachment-10982" class="wp-caption-text">Select NuGet Package</p></div>
<p>Now you can see a new window, please search for MVC grid in the search box. And then click Install. </p>
<div id="attachment_10983" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/11/Install_MVC_Grid_To_Project-e1448285055873.png"><img decoding="async" aria-describedby="caption-attachment-10983" src="http://sibeeshpassion.com/wp-content/uploads/2015/11/Install_MVC_Grid_To_Project-e1448285055873.png" alt="Install_MVC_Grid_To_Project" width="650" height="433" class="size-full wp-image-10983" srcset="/wp-content/uploads/2015/11/Install_MVC_Grid_To_Project-e1448285055873.png 650w, /wp-content/uploads/2015/11/Install_MVC_Grid_To_Project-e1448285055873-300x200.png 300w, /wp-content/uploads/2015/11/Install_MVC_Grid_To_Project-e1448285055873-400x266.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10983" class="wp-caption-text">Install_MVC_Grid_To_Project</p></div>
<p>Once you installed, you can see there is a new reference file has been added(GridMVC), you can also notice that two views are created (_Grig.cshtml,_GridPager.cshtml) and one CSS file and some scripts. Now we will move to our next step.</p>
<p><strong>Dependencies </strong></p>
<p>As I said before, MVC grid uses bootstrap for design. So the next thing we need to is to install bootstrap in our project. For that, go to NuGet packages again and search for bootstrap.</p>
<div id="attachment_10984" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/11/Install_Bootstrap_To_Project-e1448285364634.png"><img decoding="async" aria-describedby="caption-attachment-10984" src="http://sibeeshpassion.com/wp-content/uploads/2015/11/Install_Bootstrap_To_Project-e1448285364634.png" alt="Install_Bootstrap_To_Project" width="650" height="433" class="size-full wp-image-10984" srcset="/wp-content/uploads/2015/11/Install_Bootstrap_To_Project-e1448285364634.png 650w, /wp-content/uploads/2015/11/Install_Bootstrap_To_Project-e1448285364634-300x200.png 300w, /wp-content/uploads/2015/11/Install_Bootstrap_To_Project-e1448285364634-400x266.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10984" class="wp-caption-text">Install_Bootstrap_To_Project</p></div>
<p>You can see some new CSS files and scripts has been added to our project. So the set up has been done. Now what we need to do is to move on the coding part. </p>
<p><strong>Create a controller </strong></p>
<p>Now we can create a new controller, in my case I created a controller &#8216;HomeController&#8217;. In my controller I am going to call a model action which will return some dynamic data. See the code below. </p>
<p>[csharp]<br />
public class HomeController : Controller<br />
    {<br />
        //<br />
        // GET: /Home/</p>
<p>        public ActionResult Index()<br />
        {<br />
            Test t = new Test();<br />
            var myList= t.GetData();<br />
            return View(myList);<br />
        }</p>
<p>    }<br />
[/csharp]</p>
<p>As you can see I am creating an instance of my model Test, now we will create our model class. Shall we?</p>
<p><strong>Create Model </strong></p>
<p>I have create a model class with the name Test. Here I am creating some data dynamically using a for loop and assign those values to a list. Please see the codes below. </p>
<p>[csharp]<br />
namespace AsyncActions.Models<br />
{<br />
    public class Test<br />
    {<br />
        public List&lt;Customer&gt; GetData()<br />
        {<br />
            try<br />
            {<br />
                List&lt;Customer&gt; cst = new List&lt;Customer&gt;();<br />
                for (int i = 0; i &lt; 100; i++)<br />
                {<br />
                    Customer c = new Customer();<br />
                    c.CustomerID = i;<br />
                    c.CustomerCode = &quot;CST&quot; + i;<br />
                    cst.Add(c);<br />
                }<br />
                return cst;<br />
            }<br />
            catch (Exception)<br />
            {<br />
                throw new NotImplementedException();<br />
            }</p>
<p>        }<br />
    }<br />
    public class Customer<br />
    {<br />
        public int CustomerID { get; set; }<br />
        public string CustomerCode { get; set; }<br />
    }<br />
}<br />
[/csharp]</p>
<p>As you can see I am creating a list of type Customer. Is that fine? Now what is pending? Yes, a view.</p>
<p><strong>Create a strongly typed view</strong></p>
<p>Now we are going to create a strongly typed view. </p>
<div id="attachment_10985" style="width: 519px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/11/Create_Strongly_Typed_View.png"><img decoding="async" aria-describedby="caption-attachment-10985" src="http://sibeeshpassion.com/wp-content/uploads/2015/11/Create_Strongly_Typed_View.png" alt="Create_Strongly_Typed_View" width="509" height="502" class="size-full wp-image-10985" srcset="/wp-content/uploads/2015/11/Create_Strongly_Typed_View.png 509w, /wp-content/uploads/2015/11/Create_Strongly_Typed_View-300x296.png 300w, /wp-content/uploads/2015/11/Create_Strongly_Typed_View-400x394.png 400w" sizes="(max-width: 509px) 100vw, 509px" /></a><p id="caption-attachment-10985" class="wp-caption-text">Create_Strongly_Typed_View</p></div>
<blockquote><p>When you create a view as strongly typed view, your view header will be as follows. @model List<AsyncActions.Models.Customer></p></blockquote>
<p>So our view is ready, now we can do some codes in our view to populate our grid. Are you ready? First thing is you need to include the needed references to our view, you can do this in the file called Layout.cshtml. Here I am going to add those references directly to the view.</p>
<p>[html]<br />
&lt;link href=&quot;~/Content/bootstrap-theme.css&quot; rel=&quot;stylesheet&quot; /&gt;<br />
&lt;link href=&quot;~/Content/bootstrap.css&quot; rel=&quot;stylesheet&quot; /&gt;<br />
&lt;script src=&quot;~/Scripts/jquery-2.1.3.min.js&quot;&gt;&lt;/script&gt;<br />
&lt;link href=&quot;~/Content/Gridmvc.css&quot; rel=&quot;stylesheet&quot; /&gt;<br />
&lt;script src=&quot;~/Scripts/gridmvc.min.js&quot;&gt;&lt;/script&gt;<br />
[/html]</p>
<p><strong>Add the grid namespace</strong></p>
<p>You can add the grid namespace as follows.</p>
<p>[html]<br />
@using GridMvc.Html<br />
[/html]</p>
<p>Next thing is to add grid implementation.</p>
<p><strong>MVC Grid Implementation</strong></p>
<p>To add a MVC grid as our requirement, you need to add the codes as below. </p>
<p>[csharp]<br />
@Html.Grid(Model).Columns(columns =&gt;<br />
           {<br />
               columns.Add(foo =&gt; foo.CustomerID).Titled(&quot;Customer ID&quot;).SetWidth(50).Sortable(true).Filterable(true);<br />
               columns.Add(foo =&gt; foo.CustomerCode).Titled(&quot;Customer Code&quot;).SetWidth(50).Sortable(true).Filterable(true);<br />
           }).WithPaging(20)</p>
<p>[/csharp]</p>
<p>As you can see we are using the columns Customer.CustomerID and Customer.CustomerCode. </p>
<p><strong>Output</strong></p>
<div id="attachment_10986" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/11/MVC_Grid_With_Dynamic_Data.png"><img decoding="async" aria-describedby="caption-attachment-10986" src="http://sibeeshpassion.com/wp-content/uploads/2015/11/MVC_Grid_With_Dynamic_Data-1024x518.png" alt="MVC_Grid_With_Dynamic_Data" width="634" height="321" class="size-large wp-image-10986" srcset="/wp-content/uploads/2015/11/MVC_Grid_With_Dynamic_Data-1024x518.png 1024w, /wp-content/uploads/2015/11/MVC_Grid_With_Dynamic_Data-300x152.png 300w, /wp-content/uploads/2015/11/MVC_Grid_With_Dynamic_Data-768x389.png 768w, /wp-content/uploads/2015/11/MVC_Grid_With_Dynamic_Data-400x203.png 400w, /wp-content/uploads/2015/11/MVC_Grid_With_Dynamic_Data-1185x600.png 1185w, /wp-content/uploads/2015/11/MVC_Grid_With_Dynamic_Data.png 1918w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-10986" class="wp-caption-text">MVC_Grid_With_Dynamic_Data</p></div>
<p><strong>Add more Grid features</strong></p>
<p><em>To set the paging </em> we can use the option <em>WithPaging(20)</em>.<br />
<em>To add title</em> we can use <em>Titled</em> property.<br />
<em>To set width</em> we can use <em>SetWidth</em> property.<br />
<em>To set sort</em> we can use <em>Sortable</em> property.<br />
<em>To set filter</em> we can use <em>Filterable</em> property.</p>
<p>You can always see the additional options <a href="https://gridmvc.codeplex.com/documentation" target="_blank" rel="noopener">here </a>.</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/using-mvc-grid-in-mvc/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Change Themes Dynamically In Grid</title>
		<link>https://mail.sibeeshpassion.com/change-themes-dynamically-in-grid/</link>
					<comments>https://mail.sibeeshpassion.com/change-themes-dynamically-in-grid/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 28 Oct 2015 13:40:51 +0000</pubDate>
				<category><![CDATA[JQWidgets]]></category>
		<category><![CDATA[JQX Grid]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Apply Themes In Grid]]></category>
		<category><![CDATA[Change Themes Dynamically]]></category>
		<category><![CDATA[Disable The Stylesheets]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10855</guid>

					<description><![CDATA[In this post we will see how we can Change Themes Dynamically In Grid . I recently came across a situation to change the grid&#8217;s theme dynamically, when ever user select any theme. So I have done this requirement by using some in-built functionalities of jQWidget JQX grid. Here I am going to share you that. I hope you will like it. To load a grid from a JSON, you can follows the steps as discussed in this article: Load jQWidget JQX Grid From JSON Background If you are new to JQWidget JQX Grid, Please find out here: http://sibeeshpassion.com/category/jqwidgets/ Download [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will see how we can Change Themes Dynamically In Grid . I recently came across a situation to change the grid&#8217;s theme dynamically, when ever user select any theme. So I have done this requirement by using some in-built functionalities of jQWidget JQX grid. Here I am going to share you that. I hope you will like it.</p>
<p>To load a grid from a JSON, you can follows the steps as discussed in this article: <a href="http://sibeeshpassion.com/bind-json-data-to-jqwidget-jqx-grid/">Load jQWidget JQX Grid From JSON</a></p>
<p><strong>Background</strong></p>
<p>If you are new to JQWidget JQX Grid, Please find out here: <a href="http://sibeeshpassion.com/category/jqwidgets/" target="_blank">http://sibeeshpassion.com/category/jqwidgets/</a></p>
<p><strong>Download the Source Code</strong></p>
<p>Please download the source code from here: <a href="http://sibeeshpassion.com/download/changetheme.rar" target="_blank">Change Themes Dynamically</a></p>
<p><strong>Using the code</strong></p>
<p>I hope you have implemented your grid as shown in that article. Now I guess your page will be looking like this.</p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=&quot;en&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Change Themes Dynamically In Grid &#8211; Sibeesh Passion&lt;/title&gt;<br />
   &lt;script src=&quot;jquery-1.9.1.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxcore.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdata.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxbuttons.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxscrollbar.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxlistbox.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdropdownlist.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxmenu.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.selection.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdatatable.js&quot;&gt;&lt;/script&gt;</p>
<p>    &lt;script type=&quot;text/javascript&quot;&gt;<br />
        $(document).ready(function () {<br />
            // prepare the data<br />
            var data =<br />
            {<br />
                datatype: &quot;json&quot;,<br />
                datafields: [{ &quot;name&quot;: &quot;AreaCode&quot;, &quot;type&quot;: &quot;string&quot; }, { &quot;name&quot;: &quot;Revenue&quot;, &quot;type&quot;: &quot;number&quot; }],<br />
                url: &quot;jsonData.txt&quot;<br />
            };<br />
            $(&quot;#jqxgrid&quot;).jqxGrid(<br />
                  {<br />
                      source: data,<br />
                      columns: [{ &quot;text&quot;: &quot;Area Code&quot;, &quot;dataField&quot;: &quot;AreaCode&quot;, &quot;cellsalign&quot;: &quot;left&quot;, &quot;cellsformat&quot;: &quot;d&quot; }, { &quot;text&quot;: &quot;Revenue&quot;, &quot;dataField&quot;: &quot;Revenue&quot;, &quot;cellsalign&quot;: &quot;right&quot;, &quot;cellsformat&quot;: &quot;c2&quot; }],<br />
                  });<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;h3&gt;Change Themes Dynamically In Grid &#8211; Sibeesh Passion&lt;/h3&gt;<br />
    &lt;br /&gt;<br />
    &lt;div id=&#8217;jqxWidget&#8217; style=&quot;float: left; width: 99.9%;&quot;&gt;<br />
        &lt;div id=&quot;jqxgrid&quot;&gt;&lt;/div&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Now let us make sure that grid is working fine. Please run your project. </p>
<div id="attachment_10856" style="width: 620px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid.png"><img decoding="async" aria-describedby="caption-attachment-10856" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid.png" alt="Change Themes Dynamically In Grid " width="610" height="470" class="size-full wp-image-10856" srcset="/wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid.png 610w, /wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid-300x231.png 300w, /wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid-400x308.png 400w" sizes="(max-width: 610px) 100vw, 610px" /></a><p id="caption-attachment-10856" class="wp-caption-text">Change Themes Dynamically In Grid</p></div>
<p>Cool, so grid is loaded. Now need to add a select control in which we are going to load theme names so that user can select the theme and apply. Is that fine?</p>
<p>[html]<br />
  &lt;select id=&quot;selectOptions&quot; onchange=&quot;applyNewCSS()&quot;&gt;<br />
        &lt;option value=&quot;0&quot;&gt;Select Template&lt;/option&gt;<br />
        &lt;option value=&quot;metro&quot;&gt;metro&lt;/option&gt;<br />
        &lt;option value=&quot;office&quot;&gt;office&lt;/option&gt;<br />
        &lt;option value=&quot;orange&quot;&gt;orange&lt;/option&gt;<br />
        &lt;option value=&quot;energyblue&quot;&gt;energyblue&lt;/option&gt;<br />
        &lt;option value=&quot;darkblue&quot;&gt;darkblue&lt;/option&gt;<br />
        &lt;option value=&quot;shinyblack&quot;&gt;shinyblack&lt;/option&gt;<br />
        &lt;option value=&quot;lightness&quot; selected=&quot;selected&quot;&gt;lightness&lt;/option&gt;<br />
        &lt;option value=&quot;android&quot;&gt;android&lt;/option&gt;<br />
    &lt;/select&gt;<br />
[/html]</p>
<p>The next thing is we need to add the CSS links to the page, here I am going to add some of the CSS references as follows.</p>
<p>[html]<br />
&lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.darkblue.css&quot; rel=&quot;stylesheet&quot; title=&quot;darkblue&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.energyblue.css&quot; rel=&quot;stylesheet&quot; title=&quot;energyblue&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.metro.css&quot; rel=&quot;stylesheet&quot; title=&quot;metro&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.metrodark.css&quot; rel=&quot;stylesheet&quot; title=&quot;metrodark&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.office.css&quot; rel=&quot;stylesheet&quot; title=&quot;office&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.ui-darkness.css&quot; rel=&quot;stylesheet&quot; title=&quot;ui-darkness&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.ui-le-frog.css&quot; rel=&quot;stylesheet&quot; title=&quot;ui-le-frog&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.ui-lightness.css&quot; rel=&quot;stylesheet&quot; title=&quot;ui-lightness.&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.ui-sunny.css&quot; rel=&quot;stylesheet&quot; title=&quot;ui-sunny&quot; /&gt;<br />
[/html]</p>
<p>Have you noticed that we are calling the function applyNewCSS in the on change event of the select control. So next thins we will add that function.</p>
<p>[js]<br />
 function applyNewCSS() {<br />
            var css = $.trim($(&quot;#selectOptions&quot;).val());<br />
            if (css == &#8216;metro&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;metro&#8217; });<br />
            }<br />
            else if (css == &#8216;metrodark&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;metrodark&#8217; });<br />
            }<br />
            else if (css == &#8216;office&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;office&#8217; });<br />
            } else if (css == &#8216;orange&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;orange&#8217; });<br />
            } else if (css == &#8216;energyblue&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;energyblue&#8217; });<br />
            } else if (css == &#8216;darkblue&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;darkblue&#8217; });<br />
            } else if (css == &#8216;black&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;black&#8217; });<br />
            } else if (css == &#8216;shinyblack&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;shinyblack&#8217; });<br />
            } else if (css == &#8216;lightness&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;lightness&#8217; });<br />
            } else if (css == &#8216;ui-le-frog&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;ui-le-frog&#8217; });<br />
            } else if (css == &#8216;ui-darkness&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;ui-darkness&#8217; });<br />
            } else if (css == &#8216;ui-sunny&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;ui-sunny&#8217; });<br />
            }<br />
            else if (css == &#8216;android&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;android&#8217; });<br />
            }<br />
        }<br />
[/js]</p>
<blockquote><p>So we can add the theme to the grid as  $(&#8220;#jqxgrid&#8221;).jqxGrid({ theme: &#8216;theme name&#8217; });</p></blockquote>
<p>Here we are applying the theme to the grid according to the user selection. Oops, we forgot one thing. If you apply CSS style sheet directly, the styles won&#8217;t get applied in the page contents. For that we need to disable the remaining style sheets and enable the selected one alone.</p>
<p>Following code will do that magic.</p>
<p>[js]<br />
var i, link_tag;<br />
            for (i = 0, link_tag = document.getElementsByTagName(&quot;link&quot;) ; i &lt; link_tag.length; i++) {<br />
                if ((link_tag[i].rel.indexOf(&quot;stylesheet&quot;) != -1) &amp;&amp; link_tag[i].title) {<br />
                    link_tag[i].disabled = true;<br />
                    if (link_tag[i].title == css) {<br />
                        link_tag[i].disabled = false;<br />
                    }<br />
                }<br />
                set_cookie(&#8216;style&#8217;, css, 30);<br />
            }<br />
[/js]</p>
<p>We are finding all of the link reference and find out whose rel property has the word &#8216;stylesheet&#8217;. Now it is time to see how it woks. </p>
<div id="attachment_10857" style="width: 648px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_1.png"><img decoding="async" aria-describedby="caption-attachment-10857" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_1.png" alt="Change Themes Dynamically In Grid " width="638" height="540" class="size-full wp-image-10857" srcset="/wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_1.png 638w, /wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_1-300x254.png 300w, /wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_1-400x339.png 400w" sizes="(max-width: 638px) 100vw, 638px" /></a><p id="caption-attachment-10857" class="wp-caption-text">Change Themes Dynamically In Grid</p></div>
<div id="attachment_10858" style="width: 637px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_2.png"><img decoding="async" aria-describedby="caption-attachment-10858" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_2.png" alt="Change Themes Dynamically In Grid" width="627" height="505" class="size-full wp-image-10858" srcset="/wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_2.png 627w, /wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_2-300x242.png 300w, /wp-content/uploads/2015/10/Change_Themes_Dynamically_In_Grid_2-400x322.png 400w" sizes="(max-width: 627px) 100vw, 627px" /></a><p id="caption-attachment-10858" class="wp-caption-text">Change Themes Dynamically In Grid</p></div>
<p>You can see that the grid themes are changing according to the user selection of theme.That&#8217;s all we have done it. </p>
<p><strong>Complete Code</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=&quot;en&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Change Themes Dynamically In Grid &#8211; Sibeesh Passion&lt;/title&gt;<br />
    &lt;script src=&quot;jquery-1.9.1.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxcore.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdata.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxbuttons.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxscrollbar.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxlistbox.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdropdownlist.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxmenu.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.selection.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdatatable.js&quot;&gt;&lt;/script&gt;</p>
<p>    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.base.css&quot; rel=&quot;stylesheet&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.darkblue.css&quot; rel=&quot;stylesheet&quot; title=&quot;darkblue&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.energyblue.css&quot; rel=&quot;stylesheet&quot; title=&quot;energyblue&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.metro.css&quot; rel=&quot;stylesheet&quot; title=&quot;metro&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.metrodark.css&quot; rel=&quot;stylesheet&quot; title=&quot;metrodark&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.office.css&quot; rel=&quot;stylesheet&quot; title=&quot;office&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.ui-darkness.css&quot; rel=&quot;stylesheet&quot; title=&quot;ui-darkness&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.ui-le-frog.css&quot; rel=&quot;stylesheet&quot; title=&quot;ui-le-frog&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.ui-lightness.css&quot; rel=&quot;stylesheet&quot; title=&quot;ui-lightness.&quot; /&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.ui-sunny.css&quot; rel=&quot;stylesheet&quot; title=&quot;ui-sunny&quot; /&gt;</p>
<p>    &lt;script type=&quot;text/javascript&quot;&gt;<br />
        function applyNewCSS() {<br />
            var css = $.trim($(&quot;#selectOptions&quot;).val());<br />
            var i, link_tag;<br />
            for (i = 0, link_tag = document.getElementsByTagName(&quot;link&quot;) ; i &lt; link_tag.length; i++) {<br />
                if ((link_tag[i].rel.indexOf(&quot;stylesheet&quot;) != -1) &amp;&amp; link_tag[i].title) {<br />
                    link_tag[i].disabled = true;<br />
                    if (link_tag[i].title == css) {<br />
                        link_tag[i].disabled = false;<br />
                    }<br />
                }<br />
            }<br />
            if (css == &#8216;metro&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;metro&#8217; });<br />
            }<br />
            else if (css == &#8216;metrodark&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;metrodark&#8217; });<br />
            }<br />
            else if (css == &#8216;office&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;office&#8217; });<br />
            } else if (css == &#8216;orange&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;orange&#8217; });<br />
            } else if (css == &#8216;energyblue&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;energyblue&#8217; });<br />
            } else if (css == &#8216;darkblue&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;darkblue&#8217; });<br />
            } else if (css == &#8216;black&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;black&#8217; });<br />
            } else if (css == &#8216;shinyblack&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;shinyblack&#8217; });<br />
            } else if (css == &#8216;lightness&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;lightness&#8217; });<br />
            } else if (css == &#8216;ui-le-frog&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;ui-le-frog&#8217; });<br />
            } else if (css == &#8216;ui-darkness&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;ui-darkness&#8217; });<br />
            } else if (css == &#8216;ui-sunny&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;ui-sunny&#8217; });<br />
            }<br />
            else if (css == &#8216;android&#8217;) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid({ theme: &#8216;android&#8217; });<br />
            }<br />
        }<br />
        $(document).ready(function () {<br />
            // prepare the data<br />
            var data =<br />
            {<br />
                datatype: &quot;json&quot;,<br />
                datafields: [{ &quot;name&quot;: &quot;AreaCode&quot;, &quot;type&quot;: &quot;string&quot; }, { &quot;name&quot;: &quot;Revenue&quot;, &quot;type&quot;: &quot;number&quot; }],<br />
                url: &quot;jsonData.txt&quot;<br />
            };<br />
            $(&quot;#jqxgrid&quot;).jqxGrid(<br />
                  {<br />
                      source: data,<br />
                      columns: [{ &quot;text&quot;: &quot;Area Code&quot;, &quot;dataField&quot;: &quot;AreaCode&quot;, &quot;cellsalign&quot;: &quot;left&quot;, &quot;cellsformat&quot;: &quot;d&quot; }, { &quot;text&quot;: &quot;Revenue&quot;, &quot;dataField&quot;: &quot;Revenue&quot;, &quot;cellsalign&quot;: &quot;right&quot;, &quot;cellsformat&quot;: &quot;c2&quot; }],<br />
                  });<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;h3&gt;Change Themes Dynamically In Grid &#8211; Sibeesh Passion&lt;/h3&gt;<br />
    &lt;br /&gt;<br />
    &lt;div id=&#8217;jqxWidget&#8217; style=&quot;float: left; width: 99.9%;&quot;&gt;<br />
        &lt;div id=&quot;jqxgrid&quot;&gt;&lt;/div&gt;<br />
    &lt;/div&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;select id=&quot;selectOptions&quot; onchange=&quot;applyNewCSS()&quot;&gt;<br />
        &lt;option value=&quot;0&quot;&gt;Select Template&lt;/option&gt;<br />
        &lt;option value=&quot;metro&quot;&gt;metro&lt;/option&gt;<br />
        &lt;option value=&quot;office&quot;&gt;office&lt;/option&gt;<br />
        &lt;option value=&quot;orange&quot;&gt;orange&lt;/option&gt;<br />
        &lt;option value=&quot;energyblue&quot;&gt;energyblue&lt;/option&gt;<br />
        &lt;option value=&quot;darkblue&quot;&gt;darkblue&lt;/option&gt;<br />
        &lt;option value=&quot;shinyblack&quot;&gt;shinyblack&lt;/option&gt;<br />
        &lt;option value=&quot;lightness&quot; selected=&quot;selected&quot;&gt;lightness&lt;/option&gt;<br />
        &lt;option value=&quot;android&quot;&gt;android&lt;/option&gt;<br />
    &lt;/select&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Have you ever wanted to do this requirement? Did you try jQWidget yet? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/change-themes-dynamically-in-grid/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Change Header Names Dynamically In JQwidgets JQX grid</title>
		<link>https://mail.sibeeshpassion.com/change-header-names-dynamically-in-jqwidgets-jqx-grid/</link>
					<comments>https://mail.sibeeshpassion.com/change-header-names-dynamically-in-jqwidgets-jqx-grid/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 28 Oct 2015 11:15:33 +0000</pubDate>
				<category><![CDATA[JQWidgets]]></category>
		<category><![CDATA[JQX Grid]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Change Header Names Dynamically In JQwidgets JQX grid]]></category>
		<category><![CDATA[jQWidget]]></category>
		<category><![CDATA[JQXGrid]]></category>
		<category><![CDATA[setcolumnproperty JQX Grid]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10850</guid>

					<description><![CDATA[In this post we will see how we can Change Header Names Dynamically In JQwidgets JQX grid. I recently came across a situation to change the grid&#8217;s header columns text should be changed dynamically, when ever user change a text box content. So I have done this requirement by using some in-built functionalities of jQWidget JQX grid. Here I am going to share you that. I hope you will like it. To load a grid from a JSON, you can follows the steps as discussed in this article: Load jQWidget JQX Grid From JSON Background If you are new to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will see how we can Change Header Names Dynamically In JQwidgets JQX grid. I recently came across a situation to change the grid&#8217;s header columns text should be changed dynamically, when ever user change a text box content. So I have done this requirement by using some in-built functionalities of jQWidget JQX grid. Here I am going to share you that. I hope you will like it.</p>
<p>To load a grid from a JSON, you can follows the steps as discussed in this article: <a href="http://sibeeshpassion.com/bind-json-data-to-jqwidget-jqx-grid/">Load jQWidget JQX Grid From JSON</a></p>
<p><strong>Background</strong></p>
<p>If you are new to JQWidget JQX Grid, Please find out here: <a href="http://sibeeshpassion.com/category/jqwidgets/" target="_blank">http://sibeeshpassion.com/category/jqwidgets/</a></p>
<p><strong>Using the code</strong></p>
<p>I hope you have implemented your grid as shown in that article. Now I guess your page will be looking like this.</p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=&quot;en&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Change Header Names Dynamically In JQwidgets JQX grid &#8211; Sibeesh Passion&lt;/title&gt;<br />
    &lt;script src=&quot;jquery-1.9.1.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxcore.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdata.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxbuttons.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxscrollbar.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxlistbox.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdropdownlist.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxmenu.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.filter.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.sort.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.selection.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.pager.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.columnsresize.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.columnsreorder.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.export.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdata.export.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdatatable.js&quot;&gt;&lt;/script&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.base.css&quot; rel=&quot;stylesheet&quot; /&gt;</p>
<p>    &lt;script type=&quot;text/javascript&quot;&gt;<br />
        $(document).ready(function () {<br />
            // prepare the data<br />
            var data =<br />
            {<br />
                datatype: &quot;json&quot;,<br />
                datafields: [{ &quot;name&quot;: &quot;AreaCode&quot;, &quot;type&quot;: &quot;string&quot; }, { &quot;name&quot;: &quot;Revenue&quot;, &quot;type&quot;: &quot;number&quot; }],<br />
                //id: &#8216;id&#8217;,<br />
                url: &quot;jsonData.txt&quot;<br />
            };<br />
            $(&quot;#jqxgrid&quot;).jqxGrid(<br />
                  {<br />
                      source: data,<br />
                      columns: [{ &quot;text&quot;: &quot;Area Code&quot;, &quot;dataField&quot;: &quot;AreaCode&quot;, &quot;cellsalign&quot;: &quot;left&quot;, &quot;cellsformat&quot;: &quot;d&quot; }, { &quot;text&quot;: &quot;Revenue&quot;, &quot;dataField&quot;: &quot;Revenue&quot;, &quot;cellsalign&quot;: &quot;right&quot;, &quot;cellsformat&quot;: &quot;c2&quot; }],<br />
                      pageable: true,<br />
                      filterable: true,<br />
                      sortable: true<br />
                  });<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body class=&#8217;default&#8217;&gt;<br />
    &lt;h2&gt;Change Header Names Dynamically In JQwidgets JQX grid &#8211; Sibeesh Passion&lt;/h2&gt;<br />
    &lt;div id=&quot;jqxgrid&quot;&gt;&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Now let us make sure that grid is working fine. Please run your project. </p>
<div id="attachment_10851" style="width: 653px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid.png"><img decoding="async" aria-describedby="caption-attachment-10851" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid.png" alt="Change Header Names Dynamically In JQwidgets JQX grid" width="643" height="475" class="size-full wp-image-10851" srcset="/wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid.png 643w, /wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid-300x222.png 300w, /wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid-400x295.png 400w" sizes="(max-width: 643px) 100vw, 643px" /></a><p id="caption-attachment-10851" class="wp-caption-text">Change Header Names Dynamically In JQwidgets JQX grid</p></div>
<p>Cool, so grid is loaded. Now need to add a select control in which we are going to load the grid header names so that user can select which one&#8217;s header must be changed, and a text box where a user can enter the text to be changed for the selected header. Is that fine?</p>
<p>[html]<br />
  &lt;select id=&quot;selectOptions&quot;&gt;&lt;/select&gt;<br />
    &lt;input type=&quot;text&quot; id=&quot;changeName&quot; /&gt;<br />
[/html]</p>
<p>The next thing is we need to add the options to the select control. Right? We can get the column properties of JQX grid as $(&#8220;#jqxgrid&#8221;).jqxGrid(&#8216;columns&#8217;).records. Now we will create a ready function in the grid settings and append the values. Following is the code for that.</p>
<p>[js]<br />
 ready: function () {<br />
                          var options = &quot;&lt;option value=&#8217;0&#8242;&gt;&#8211;Select Header&#8211;&lt;/option&gt;&quot;;<br />
                          var headerNames = $(&quot;#jqxgrid&quot;).jqxGrid(&#8216;columns&#8217;).records;<br />
                          for (var i = 0; i &lt; headerNames.length; i++) {<br />
                              options += &quot;&lt;option value = &#8216;&quot; + headerNames[i].datafield + &quot;&#8217;&gt;&quot; + headerNames[i].text + &quot; &lt;/option&gt;&quot;;<br />
                          }<br />
                          $(&quot;#selectOptions&quot;).html(options);<br />
                      }<br />
[/js]</p>
<p>What is next? Yeah, we need to fire the text box change event. </p>
<p>[js]<br />
$(&quot;#changeName&quot;).change(function (e) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid(&#8216;setcolumnproperty&#8217;, $(&#8216;#selectOptions option:selected&#8217;).val(), &#8216;text&#8217;, $(&#8216;#changeName&#8217;).val());<br />
            });<br />
[/js]</p>
<p>In the text box change event we have written the code to change the header column text property.</p>
<blockquote><p>Here we are using setcolumnproperty method which already available in the JQWidget library.</p></blockquote>
<p>Now it is time to see how it woks. </p>
<div id="attachment_10852" style="width: 654px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid_1.png"><img decoding="async" aria-describedby="caption-attachment-10852" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid_1.png" alt="Change Header Names Dynamically In JQwidgets JQX grid" width="644" height="567" class="size-full wp-image-10852" srcset="/wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid_1.png 644w, /wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid_1-300x264.png 300w, /wp-content/uploads/2015/10/Change_Header_Names_Dynamically_In_JQwidgets_JQX_grid_1-400x352.png 400w" sizes="(max-width: 644px) 100vw, 644px" /></a><p id="caption-attachment-10852" class="wp-caption-text">Change Header Names Dynamically In JQwidgets JQX grid</p></div>
<p>You can see that the header column text has been changed from &#8216;Area Code&#8217; to &#8216;New Area Code&#8217;.That&#8217;s all we have done it. </p>
<p><strong>Complete Code</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=&quot;en&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Change Header Names Dynamically In JQwidgets JQX grid &#8211; Sibeesh Passion&lt;/title&gt;<br />
    &lt;script src=&quot;jquery-1.9.1.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxcore.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdata.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxbuttons.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxscrollbar.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxlistbox.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdropdownlist.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxmenu.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.filter.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.sort.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.selection.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.pager.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.columnsresize.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.columnsreorder.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.export.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdata.export.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdatatable.js&quot;&gt;&lt;/script&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.base.css&quot; rel=&quot;stylesheet&quot; /&gt;</p>
<p>    &lt;script type=&quot;text/javascript&quot;&gt;<br />
        $(document).ready(function () {<br />
            // prepare the data<br />
            var data =<br />
            {<br />
                datatype: &quot;json&quot;,<br />
                datafields: [{ &quot;name&quot;: &quot;AreaCode&quot;, &quot;type&quot;: &quot;string&quot; }, { &quot;name&quot;: &quot;Revenue&quot;, &quot;type&quot;: &quot;number&quot; }],<br />
                //id: &#8216;id&#8217;,<br />
                url: &quot;jsonData.txt&quot;<br />
            };<br />
            $(&quot;#jqxgrid&quot;).jqxGrid(<br />
                  {<br />
                      source: data,<br />
                      columns: [{ &quot;text&quot;: &quot;Area Code&quot;, &quot;dataField&quot;: &quot;AreaCode&quot;, &quot;cellsalign&quot;: &quot;left&quot;, &quot;cellsformat&quot;: &quot;d&quot; }, { &quot;text&quot;: &quot;Revenue&quot;, &quot;dataField&quot;: &quot;Revenue&quot;, &quot;cellsalign&quot;: &quot;right&quot;, &quot;cellsformat&quot;: &quot;c2&quot; }],<br />
                      pageable: true,<br />
                      filterable: true,<br />
                      sortable: true,<br />
                      ready: function () {<br />
                          var options = &quot;&lt;option value=&#8217;0&#8242;&gt;&#8211;Select Header&#8211;&lt;/option&gt;&quot;;<br />
                          var headerNames = $(&quot;#jqxgrid&quot;).jqxGrid(&#8216;columns&#8217;).records;<br />
                          for (var i = 0; i &lt; headerNames.length; i++) {<br />
                              options += &quot;&lt;option value = &#8216;&quot; + headerNames[i].datafield + &quot;&#8217;&gt;&quot; + headerNames[i].text + &quot; &lt;/option&gt;&quot;;<br />
                          }<br />
                          $(&quot;#selectOptions&quot;).html(options);<br />
                      }<br />
                  });<br />
            $(&quot;#changeName&quot;).change(function (e) {<br />
                $(&quot;#jqxgrid&quot;).jqxGrid(&#8216;setcolumnproperty&#8217;, $(&#8216;#selectOptions option:selected&#8217;).val(), &#8216;text&#8217;, $(&#8216;#changeName&#8217;).val());<br />
            });<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body class=&#8217;default&#8217;&gt;<br />
    &lt;h3&gt;Change Header Names Dynamically In JQwidgets JQX grid &#8211; Sibeesh Passion&lt;/h3&gt;<br />
    &lt;br /&gt;<br />
    &lt;div id=&quot;jqxgrid&quot;&gt;&lt;/div&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;select id=&quot;selectOptions&quot;&gt;&lt;/select&gt;<br />
    &lt;input type=&quot;text&quot; id=&quot;changeName&quot; /&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Have you ever wanted to do this requirement? Did you try jQWidget yet? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/change-header-names-dynamically-in-jqwidgets-jqx-grid/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Order Filter Conditions In jQWidget JQX Grid</title>
		<link>https://mail.sibeeshpassion.com/order-filter-conditions-in-jqwidget-jqx-grid/</link>
					<comments>https://mail.sibeeshpassion.com/order-filter-conditions-in-jqwidget-jqx-grid/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 20 Oct 2015 09:56:57 +0000</pubDate>
				<category><![CDATA[JQWidgets]]></category>
		<category><![CDATA[JQX Grid]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Default Filter Condition in Grid Filter Dropdown]]></category>
		<category><![CDATA[jQWidget]]></category>
		<category><![CDATA[JQX Grid Filter]]></category>
		<category><![CDATA[Order Filter Conditions In jQWidget JQX Grid]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10816</guid>

					<description><![CDATA[In this post we will see how we can set the default filter condition in JQX Grid filter drop down or how we can order jqx grid jqwidget filter conditions. I recently came across a situation that the grid filter condition must be shown as &#8216;equal&#8217; for any type of filter like string, numeric. So I have done this requirement by using some in-built functionalities of jQWidget JQX grid. Here I am going to share you that. I hope you will like it. To load a grid from a JSON, you can follows the steps as discussed in this article: [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will see how we can set the default filter condition in JQX Grid filter drop down or how we can order jqx grid jqwidget filter conditions. I recently came across a situation that the grid filter condition must be shown as &#8216;equal&#8217; for any type of filter like string, numeric. So I have done this requirement by using some in-built functionalities of jQWidget JQX grid. Here I am going to share you that. I hope you will like it.</p>
<p>To load a grid from a JSON, you can follows the steps as discussed in this article: <a href="http://sibeeshpassion.com/bind-json-data-to-jqwidget-jqx-grid/">Load jQWidget JQX Grid From JSON</a></p>
<p><strong>Background</strong></p>
<p>If you are new to JQWidget JQX Grid, Please find out here: <a href="http://sibeeshpassion.com/category/jqwidgets/" target="_blank">http://sibeeshpassion.com/category/jqwidgets/</a></p>
<p><strong>Using the code</strong></p>
<p>I hope you have implemented your grid as shown in that article. Now I guess your page will be looking like this.</p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=&quot;en&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Order Filter Conditions In JQX Grid &#8211; Sibeesh Passion&lt;/title&gt;<br />
    &lt;script src=&quot;jquery-1.9.1.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxcore.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdata.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxbuttons.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxscrollbar.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxlistbox.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdropdownlist.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxmenu.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.filter.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.sort.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.selection.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.pager.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.columnsresize.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.columnsreorder.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxgrid.export.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdata.export.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot; src=&quot;JQXItems/jqwidgets/jqxdatatable.js&quot;&gt;&lt;/script&gt;<br />
    &lt;link href=&quot;JQXItems/jqwidgets/styles/jqx.base.css&quot; rel=&quot;stylesheet&quot; /&gt;</p>
<p>    &lt;script type=&quot;text/javascript&quot;&gt;<br />
        $(document).ready(function () {<br />
            // prepare the data<br />
            var data =<br />
            {<br />
                datatype: &quot;json&quot;,<br />
                datafields: [{ &quot;name&quot;: &quot;AreaCode&quot;, &quot;type&quot;: &quot;string&quot; }, { &quot;name&quot;: &quot;Revenue&quot;, &quot;type&quot;: &quot;number&quot; }],<br />
                //id: &#8216;id&#8217;,<br />
                url: &quot;jsonData.txt&quot;<br />
            };<br />
            $(&quot;#jqxgrid&quot;).jqxGrid(<br />
                  {<br />
                      source: data,<br />
                      columns: [{ &quot;text&quot;: &quot;Area Code&quot;, &quot;dataField&quot;: &quot;AreaCode&quot;, &quot;cellsalign&quot;: &quot;left&quot;, &quot;cellsformat&quot;: &quot;d&quot; }, { &quot;text&quot;: &quot;Revenue&quot;, &quot;dataField&quot;: &quot;Revenue&quot;, &quot;cellsalign&quot;: &quot;right&quot;, &quot;cellsformat&quot;: &quot;c2&quot; }],<br />
                      pageable: true,<br />
                      filterable: true,<br />
                      sortable: true<br />
                  });<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body class=&#8217;default&#8217;&gt;<br />
    &lt;h2&gt;Order Filter Conditions In JQX Grid &#8211; Sibeesh Passion&lt;/h2&gt;<br />
    &lt;div id=&quot;jqxgrid&quot;&gt;&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Now let us make sure that grid is working fine. Please run your project. </p>
<div id="attachment_10817" style="width: 637px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid.png"><img decoding="async" aria-describedby="caption-attachment-10817" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid.png" alt="Order Filter Conditions In jQWidget JQX Grid" width="627" height="485" class="size-full wp-image-10817" srcset="/wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid.png 627w, /wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid-300x232.png 300w, /wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid-400x309.png 400w" sizes="(max-width: 627px) 100vw, 627px" /></a><p id="caption-attachment-10817" class="wp-caption-text">Order Filter Conditions In jQWidget JQX Grid</p></div>
<p>Cool, so grid is loaded. Now have you noticed that the filter condition shows by default is &#8216;Contains&#8217; ? Now we are going to change that. You might be thinking what kind of requirement is this. But trust me. If client ask, we must do anything at any cost. </p>
<p>Now we are going to add three functions to the grid settings. </p>
<li>rendered</li>
<li>updatefilterconditions</li>
<li>updatefilterpanel</li>
<p>So our grid settings will be looking as follows. </p>
<p>[js]<br />
 $(&quot;#jqxgrid&quot;).jqxGrid(<br />
                  {<br />
                      source: data,<br />
                      columns: [{ &quot;text&quot;: &quot;Area Code&quot;, &quot;dataField&quot;: &quot;AreaCode&quot;, &quot;cellsalign&quot;: &quot;left&quot;, &quot;cellsformat&quot;: &quot;d&quot; }, { &quot;text&quot;: &quot;Revenue&quot;, &quot;dataField&quot;: &quot;Revenue&quot;, &quot;cellsalign&quot;: &quot;right&quot;, &quot;cellsformat&quot;: &quot;c2&quot; }],<br />
                      pageable: true,<br />
                      filterable: true,<br />
                      sortable: true,<br />
                      rendered: function () {<br />
                          var localizationobj = {};<br />
                          filterstringcomparisonoperators = [&#8216;equal&#8217;, &#8217;empty&#8217;, &#8216;not empty&#8217;, &#8216;contains&#8217;, &#8216;does not contain&#8217;, &#8216;starts with&#8217;, &#8216;ends with&#8217;, &#8216;null&#8217;];<br />
                          filternumericcomparisonoperators = [&#8216;equal&#8217;, &#8216;not equal&#8217;, &#8216;less than&#8217;, &#8216;less than or equal&#8217;, &#8216;greater than&#8217;, &#8216;greater than or equal&#8217;, &#8216;null&#8217;, &#8216;not null&#8217;];<br />
                          filterdatecomparisonoperators = [&#8216;equal&#8217;, &#8216;not equal&#8217;, &#8216;less than&#8217;, &#8216;less than or equal&#8217;, &#8216;greater than&#8217;, &#8216;greater than or equal&#8217;, &#8216;null&#8217;, &#8216;not null&#8217;];<br />
                          filterbooleancomparisonoperators = [&#8216;equal&#8217;, &#8216;not equal&#8217;];</p>
<p>                          localizationobj.filterstringcomparisonoperators = filterstringcomparisonoperators;<br />
                          localizationobj.filternumericcomparisonoperators = filternumericcomparisonoperators;<br />
                          localizationobj.filterdatecomparisonoperators = filterdatecomparisonoperators;<br />
                          localizationobj.filterbooleancomparisonoperators = filterbooleancomparisonoperators;</p>
<p>                          // apply localization.<br />
                          $(&quot;#jqxgrid&quot;).jqxGrid(&#8216;localizestrings&#8217;, localizationobj);<br />
                      },<br />
                      updatefilterconditions: function (type, defaultconditions) {<br />
                          var stringcomparisonoperators = [&#8216;EQUAL&#8217;, &#8216;EMPTY&#8217;, &#8216;NOT_EMPTY&#8217;, &#8216;CONTAINS&#8217;, &#8216;DOES_NOT_CONTAIN&#8217;, &#8216;STARTS_WITH&#8217;, &#8216;ENDS_WITH&#8217;, &#8216;NULL&#8217;];<br />
                          var numericcomparisonoperators = [&#8216;EQUAL&#8217;, &#8216;NOT_EQUAL&#8217;, &#8216;LESS_THAN&#8217;, &#8216;LESS_THAN_OR_EQUAL&#8217;, &#8216;GREATER_THAN&#8217;, &#8216;GREATER_THAN_OR_EQUAL&#8217;, &#8216;NULL&#8217;, &#8216;NOT_NULL&#8217;];<br />
                          var datecomparisonoperators = [&#8216;EQUAL&#8217;, &#8216;NOT_EQUAL&#8217;, &#8216;LESS_THAN&#8217;, &#8216;LESS_THAN_OR_EQUAL&#8217;, &#8216;GREATER_THAN&#8217;, &#8216;GREATER_THAN_OR_EQUAL&#8217;, &#8216;NULL&#8217;, &#8216;NOT_NULL&#8217;];<br />
                          var booleancomparisonoperators = [&#8216;EQUAL&#8217;, &#8216;NOT_EQUAL&#8217;];<br />
                          switch (type) {<br />
                              case &#8216;stringfilter&#8217;:<br />
                                  return stringcomparisonoperators;<br />
                              case &#8216;numericfilter&#8217;:<br />
                                  return numericcomparisonoperators;<br />
                              case &#8216;datefilter&#8217;:<br />
                                  return datecomparisonoperators;<br />
                              case &#8216;booleanfilter&#8217;:<br />
                                  return booleancomparisonoperators;<br />
                          }<br />
                      },<br />
                      updatefilterpanel: function (filtertypedropdown1, filtertypedropdown2, filteroperatordropdown, filterinputfield1, filterinputfield2, filterbutton, clearbutton,<br />
                           columnfilter, filtertype, filterconditions) {<br />
                          var index1 = 0;<br />
                          var index2 = 0;<br />
                          filtertypedropdown1.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index1 });<br />
                          filtertypedropdown2.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index2 });<br />
                      }<br />
                  });<br />
        });<br />
[/js]</p>
<p>Here in the <em>updatefilterpanel</em> we are setting the index for the filter drop down. And in <em>updatefilterconditions</em> and <em>rendered</em> functions we are applying the localization according to our requirement. Now save the changes and run your grid again, you can see the filter option &#8216;equal&#8217; will be loaded as default. </p>
<div id="attachment_10818" style="width: 622px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid1.png"><img decoding="async" aria-describedby="caption-attachment-10818" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid1.png" alt="Order Filter Conditions In jQWidget JQX Grid" width="612" height="470" class="size-full wp-image-10818" srcset="/wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid1.png 612w, /wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid1-300x230.png 300w, /wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid1-400x307.png 400w" sizes="(max-width: 612px) 100vw, 612px" /></a><p id="caption-attachment-10818" class="wp-caption-text">Order Filter Conditions In jQWidget JQX Grid</p></div>
<div id="attachment_10819" style="width: 631px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid2.png"><img decoding="async" aria-describedby="caption-attachment-10819" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid2.png" alt="Order Filter Conditions In jQWidget JQX Grid" width="621" height="480" class="size-full wp-image-10819" srcset="/wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid2.png 621w, /wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid2-300x232.png 300w, /wp-content/uploads/2015/10/Order_Filter_Conditions_In_jQWidget_JQX_Grid2-400x309.png 400w" sizes="(max-width: 621px) 100vw, 621px" /></a><p id="caption-attachment-10819" class="wp-caption-text">Order Filter Conditions In jQWidget JQX Grid</p></div>
<p>That&#8217;s all we have done this requirement of ordering the jQWidget JQX grid filter conditions. </p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Have you ever wanted to do this requirement? Did you try jQWidget yet? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/order-filter-conditions-in-jqwidget-jqx-grid/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Custom Events In Highcharts</title>
		<link>https://mail.sibeeshpassion.com/custom-events-in-highcharts/</link>
					<comments>https://mail.sibeeshpassion.com/custom-events-in-highcharts/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 06 Oct 2015 13:38:03 +0000</pubDate>
				<category><![CDATA[HighChart]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Custom Events In HighChart]]></category>
		<category><![CDATA[Double Click Event In HighChart Points]]></category>
		<category><![CDATA[Drill Down Chart]]></category>
		<category><![CDATA[HighChart Events]]></category>
		<category><![CDATA[Show Alert When Double Click]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10762</guid>

					<description><![CDATA[In this post we will discuss how we can handle custom events in HighChart . HighChart has already given enough events but sometimes we may need to handle some additional events. For example if we need to fire an alert if user double clicks on the points. Here I am using HighChart Drill Down Chart, So As you all know drill down chart is a chart which populate another chart according to the user action, ie if user click on a particular series, a chart with the related data of the clicked series will get loaded. Now we will go [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will discuss how we can handle custom events in <a href="http://sibeeshpassion.com/category/highchart/" target="_blank">HighChart </a>. HighChart has already given enough events but sometimes we may need to handle some additional events. For example if we need to fire an alert if user double clicks on the points. Here I am using HighChart Drill Down Chart, So As you all know drill down chart is a chart which populate another chart according to the user action, ie if user click on a particular series, a chart with the related data of the clicked series will get loaded. Now we will go and see it in action. I hope you will like this. </p>
<p><strong>Background</strong></p>
<p>I am working in a BI dashboard application, thus recently I got a requirement of giving an alert if user clicks on the chart point. Here I will explain the same with an example of high chart drill down type. </p>
<p>Please see the demo here: <a href="http://sibeeshpassion.com/demo/Fire-Double-Click-Event-InHighChart.html" target="_blank">Custom Events in Drill Down Chart</a></p>
<p><strong>Using the code</strong></p>
<p>First of all we will create a page as follows.</p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Fire Double Click Events In Highcharts&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Fire Double Click Events In Highcharts &#8211; Sibeesh Passion (&lt;a href=&quot;http://sibeeshpassion.com&quot;&gt;Sibeesh Passion &lt;/a&gt;)<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;div id=&quot;container&quot; style=&quot;height: 300px&quot;&gt;&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Next we will add the needed references. </p>
<p>[js]<br />
 &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/jquery-2.0.2.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/highcharts.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/drilldown.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://blacklabel.github.io/custom_events/customEvents.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Here you can see we have added a file <em>customEvents.js</em>, please do not forget to add this file. This is much important.</p>
<p>The next step is to load the chart, We can create a chart as follows. </p>
<p>[js]<br />
&lt;script&gt;<br />
        $(document).ready(function () {<br />
            // Internationalization<br />
            Highcharts.setOptions({<br />
                lang: {<br />
                    drillUpText: &#8216;? Back to {series.name}&#8217;<br />
                }<br />
            });</p>
<p>            var options = {<br />
                chart: {<br />
                    height: 300,<br />
                    events: {<br />
                    }<br />
                },</p>
<p>                title: {<br />
                    text: &#8216;Highcharts Drilldown Plugin&#8217;<br />
                },</p>
<p>                xAxis: {<br />
                    categories: true<br />
                },</p>
<p>                drilldown: {<br />
                    series: [{<br />
                        id: &#8216;fruits&#8217;,<br />
                        name: &#8216;Fruits&#8217;,<br />
                        data: [<br />
                            [&#8216;Apples&#8217;, 4],<br />
                            [&#8216;Pears&#8217;, 6],<br />
                            [&#8216;Oranges&#8217;, 2],<br />
                            [&#8216;Grapes&#8217;, 8]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;cars&#8217;,<br />
                        name: &#8216;Cars&#8217;,<br />
                        data: [{<br />
                            name: &#8216;Toyota&#8217;,<br />
                            y: 4,<br />
                            drilldown: &#8216;toyota&#8217;<br />
                        },<br />
                        [&#8216;Volkswagen&#8217;, 3],<br />
                        [&#8216;Opel&#8217;, 5]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;toyota&#8217;,<br />
                        name: &#8216;Toyota&#8217;,<br />
                        data: [<br />
                            [&#8216;RAV4&#8217;, 3],<br />
                            [&#8216;Corolla&#8217;, 1],<br />
                            [&#8216;Carina&#8217;, 4],<br />
                            [&#8216;Land Cruiser&#8217;, 5]<br />
                        ]<br />
                    }]<br />
                },</p>
<p>                legend: {<br />
                    enabled: false<br />
                },<br />
                series: [{<br />
                    name: &#8216;Overview&#8217;,<br />
                    colorByPoint: true,<br />
                    data: [{<br />
                        name: &#8216;Fruits&#8217;,<br />
                        y: 10,<br />
                        drilldown: &#8216;fruits&#8217;<br />
                    }, {<br />
                        name: &#8216;Cars&#8217;,<br />
                        y: 12,<br />
                        drilldown: &#8216;cars&#8217;<br />
                    }, {<br />
                        name: &#8216;Countries&#8217;,<br />
                        y: 8<br />
                    }]<br />
                }]<br />
            };</p>
<p>            // Drill Down Chart Implementation<br />
            options.chart.renderTo = &#8216;container&#8217;;<br />
            options.chart.type = &#8216;column&#8217;;<br />
            var chart1 = new Highcharts.Chart(options);</p>
<p>        });<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>Now if you run your page you can see a drill down chart as follows. </p>
<div id="attachment_10764" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts.png"><img decoding="async" aria-describedby="caption-attachment-10764" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-1024x301.png" alt="Fire Double Click Events In Highcharts " width="634" height="186" class="size-large wp-image-10764" srcset="/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-1024x301.png 1024w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-300x88.png 300w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-768x225.png 768w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts-400x117.png 400w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts.png 1356w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-10764" class="wp-caption-text">Fire Double Click Events In Highcharts</p></div>
<p>Now here is the main part, we need to add a plot option to the chart option so that we can track the events. Please add the preceding lines of code.</p>
<p>[js]<br />
plotOptions: {<br />
                    series: {<br />
                        point: {<br />
                            events: {<br />
                                dblclick: function () {<br />
                                    setTimeout(function () {<br />
                                        alert(&#8216;Double Click Is Not Permitted&#8217;);<br />
                                    }, 1000);<br />
                                    return false;<br />
                                }<br />
                            }<br />
                        }<br />
                    }<br />
                }<br />
[/js]</p>
<p>We have created a custom double click event <em>dblclick</em> successfully. In this way you can create custom events in highchart wherever you want, like create click and double click event in axis and label and data labels so on&#8230;</p>
<p>That&#8217;s all, we did it. Now please find the complete code.</p>
<p><strong>Complete Code</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Fire Double Click Events In Highcharts&lt;/title&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/jquery-2.0.2.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/highcharts.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://sibeeshpassion.com/content/scripts/drilldown.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;http://blacklabel.github.io/custom_events/customEvents.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        $(document).ready(function () {<br />
            // Internationalization<br />
            Highcharts.setOptions({<br />
                lang: {<br />
                    drillUpText: &#8216;? Back to {series.name}&#8217;<br />
                }<br />
            });</p>
<p>            var options = {<br />
                chart: {<br />
                    height: 300,<br />
                    events: {<br />
                    }<br />
                },</p>
<p>                title: {<br />
                    text: &#8216;Highcharts Drilldown Plugin&#8217;<br />
                },</p>
<p>                xAxis: {<br />
                    categories: true<br />
                },</p>
<p>                drilldown: {<br />
                    series: [{<br />
                        id: &#8216;fruits&#8217;,<br />
                        name: &#8216;Fruits&#8217;,<br />
                        data: [<br />
                            [&#8216;Apples&#8217;, 4],<br />
                            [&#8216;Pears&#8217;, 6],<br />
                            [&#8216;Oranges&#8217;, 2],<br />
                            [&#8216;Grapes&#8217;, 8]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;cars&#8217;,<br />
                        name: &#8216;Cars&#8217;,<br />
                        data: [{<br />
                            name: &#8216;Toyota&#8217;,<br />
                            y: 4,<br />
                            drilldown: &#8216;toyota&#8217;<br />
                        },<br />
                        [&#8216;Volkswagen&#8217;, 3],<br />
                        [&#8216;Opel&#8217;, 5]<br />
                        ]<br />
                    }, {<br />
                        id: &#8216;toyota&#8217;,<br />
                        name: &#8216;Toyota&#8217;,<br />
                        data: [<br />
                            [&#8216;RAV4&#8217;, 3],<br />
                            [&#8216;Corolla&#8217;, 1],<br />
                            [&#8216;Carina&#8217;, 4],<br />
                            [&#8216;Land Cruiser&#8217;, 5]<br />
                        ]<br />
                    }]<br />
                },</p>
<p>                legend: {<br />
                    enabled: false<br />
                },</p>
<p>                plotOptions: {<br />
                    series: {<br />
                        point: {<br />
                            events: {<br />
                                dblclick: function () {<br />
                                    setTimeout(function () {<br />
                                        alert(&#8216;Double Click Is Not Permitted&#8217;);<br />
                                    }, 1000);<br />
                                    return false;<br />
                                }<br />
                            }<br />
                        }<br />
                    }<br />
                },<br />
                series: [{<br />
                    name: &#8216;Overview&#8217;,<br />
                    colorByPoint: true,<br />
                    data: [{<br />
                        name: &#8216;Fruits&#8217;,<br />
                        y: 10,<br />
                        drilldown: &#8216;fruits&#8217;<br />
                    }, {<br />
                        name: &#8216;Cars&#8217;,<br />
                        y: 12,<br />
                        drilldown: &#8216;cars&#8217;<br />
                    }, {<br />
                        name: &#8216;Countries&#8217;,<br />
                        y: 8<br />
                    }]<br />
                }]<br />
            };</p>
<p>            // Drill Down Chart Implementation<br />
            options.chart.renderTo = &#8216;container&#8217;;<br />
            options.chart.type = &#8216;column&#8217;;<br />
            var chart1 = new Highcharts.Chart(options);</p>
<p>        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Fire Double Click Events In Highcharts &#8211; Sibeesh Passion (&lt;a href=&quot;http://sibeeshpassion.com&quot;&gt;Sibeesh Passion &lt;/a&gt;)<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;div id=&quot;container&quot; style=&quot;height: 300px&quot;&gt;&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Now if you run and double click on any series, you will get an output as follows.</p>
<div id="attachment_10769" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1.png"><img decoding="async" aria-describedby="caption-attachment-10769" src="http://sibeeshpassion.com/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-1024x294.png" alt="Fire Double Click Events In Highcharts" width="634" height="182" class="size-large wp-image-10769" srcset="/wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-1024x294.png 1024w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-300x86.png 300w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-768x221.png 768w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1-400x115.png 400w, /wp-content/uploads/2015/10/Fire_Double_Click_Events_In_Highcharts_1.png 1357w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-10769" class="wp-caption-text">Fire Double Click Events In Highcharts</p></div>
<p>Please see the JSFiddle link here: <a href="http://jsfiddle.net/sibeeshvenu/h7x37dbr/" target="_blank">Fire Double Click Events In Highcharts </a></p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Have you ever wanted this requirement while you play with highchart? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I am able to.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/custom-events-in-highcharts/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Using Spire.PDF In Asp.Net</title>
		<link>https://mail.sibeeshpassion.com/using-spire-pdf-in-asp-net/</link>
					<comments>https://mail.sibeeshpassion.com/using-spire-pdf-in-asp-net/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Mon, 24 Aug 2015 16:41:58 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Spire.PDF]]></category>
		<category><![CDATA[Adding a watermark To PDF]]></category>
		<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[Convert PDF Page to Image]]></category>
		<category><![CDATA[Decryption of PDF File]]></category>
		<category><![CDATA[Encrypting PDF File]]></category>
		<category><![CDATA[Using Spire]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10081</guid>

					<description><![CDATA[In this article we are going to see a new product Spire.PDF which helps us to create, manipulate PDF and many more. This product has been introduced by the company E-Iceblue. The company has introduced so many products like this. For example Spire.Doc, Spire.XLS. I hope you have read my articles under these categories. If you have not read them, I suggest you to rad here. Using Spire.Doc Using Spire.Xls Working With Charts Using Spire.Xls Download source code Using Spire PDF Background As you all know a PDF is a most accurate and effective format of a document. A document [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article we are going to see a new product <em>Spire.PDF</em> which helps us to create, manipulate PDF and many more. This product has been introduced by the company <a href="http://www.e-iceblue.com/" target="_blank" rel="noopener">E-Iceblue</a>. The company has introduced so many products like this. For example Spire.Doc, Spire.XLS. I hope you have read my articles under these categories. If you have not read them, I suggest you to rad here.</p>
<li><a href="http://sibeeshpassion.com/using-spire-doc-introduction/" target="_blank" rel="noopener">Using Spire.Doc</a></li>
<li><a href="http://sibeeshpassion.com/using-spire-xls/" target="_blank" rel="noopener">Using Spire.Xls</a></li>
<li><a href="http://sibeeshpassion.com/working-with-charts-using-spire-xls/" target="_blank" rel="noopener">Working With Charts Using Spire.Xls</a></li>
<p><strong>Download source code </strong></p>
<p><a href="http://sibeeshpassion.com/download/UsingSpirePDF.rar" target="_blank" rel="noopener">Using Spire PDF</a></p>
<p><strong>Background</strong></p>
<p>As you all know a PDF is a most accurate and effective format of a document. A document is very important in our life, so we create PDF files. Now coming to the matter, As we all are developers, we develops anything that is needed. But have you ever tried creating and managing PDF file? Awww!. That&#8217;s a quite difficult task right? Still it is possible. &#8220;Everything is possible, the word impossible itself says I am possible&#8221;. Now It is time to introduce you a product which let you do these task in an easy manner. So that means, you are able to do these task with a little effort. </p>
<p><strong>Create a new Project</strong></p>
<p>Now we will create a new Project in our Visual studio.</p>
<div id="attachment_10091" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Create_New_Project-e1440348497731.png"><img decoding="async" aria-describedby="caption-attachment-10091" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Create_New_Project-e1440348497731.png" alt="Using_Spire_PDF_Create_New_Project" width="650" height="397" class="size-full wp-image-10091" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Create_New_Project-e1440348497731.png 650w, /wp-content/uploads/2015/08/Using_Spire_PDF_Create_New_Project-e1440348497731-300x183.png 300w, /wp-content/uploads/2015/08/Using_Spire_PDF_Create_New_Project-e1440348497731-400x244.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10091" class="wp-caption-text">Using_Spire_PDF_Create_New_Project</p></div>
<p><strong>Add License Information To Project</strong></p>
<p>I am using evaluation version with one month temporary license. There are free versions also available for spire.pdf with some limitation. You can try that. </p>
<div id="attachment_10101" style="width: 664px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Add_License_To_Project.png"><img decoding="async" aria-describedby="caption-attachment-10101" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Add_License_To_Project.png" alt="Using_Spire_PDF_Add_License_To_Project" width="654" height="150" class="size-full wp-image-10101" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Add_License_To_Project.png 654w, /wp-content/uploads/2015/08/Using_Spire_PDF_Add_License_To_Project-300x69.png 300w, /wp-content/uploads/2015/08/Using_Spire_PDF_Add_License_To_Project-400x92.png 400w" sizes="(max-width: 654px) 100vw, 654px" /></a><p id="caption-attachment-10101" class="wp-caption-text">Using_Spire_PDF_Add_License_To_Project</p></div>
<p><strong>Download the files</strong></p>
<p>You can always the needed files from here: <a href="http://www.e-iceblue.com/Download/download-pdf-for-net-now.html" target="_blank" rel="noopener">Download Spire.PDF</a></p>
<p><strong>Install Spire.PDF</strong></p>
<p>Now click on the exe file after you extract the downloaded file. The installation will get started then.</p>
<div id="attachment_10121" style="width: 519px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Installing.png"><img decoding="async" aria-describedby="caption-attachment-10121" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Installing.png" alt="Using_Spire_PDF_Installing" width="509" height="399" class="size-full wp-image-10121" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Installing.png 509w, /wp-content/uploads/2015/08/Using_Spire_PDF_Installing-300x235.png 300w, /wp-content/uploads/2015/08/Using_Spire_PDF_Installing-400x314.png 400w" sizes="(max-width: 509px) 100vw, 509px" /></a><p id="caption-attachment-10121" class="wp-caption-text">Using_Spire_PDF_Installing</p></div>
<div id="attachment_10131" style="width: 519px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Installing_Complete.png"><img decoding="async" aria-describedby="caption-attachment-10131" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Installing_Complete.png" alt="Using_Spire_PDF_Installing_Complete" width="509" height="399" class="size-full wp-image-10131" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Installing_Complete.png 509w, /wp-content/uploads/2015/08/Using_Spire_PDF_Installing_Complete-300x235.png 300w, /wp-content/uploads/2015/08/Using_Spire_PDF_Installing_Complete-400x314.png 400w" sizes="(max-width: 509px) 100vw, 509px" /></a><p id="caption-attachment-10131" class="wp-caption-text">Using_Spire_PDF_Installing_Complete</p></div>
<p>So Shall we start?</p>
<p>Once you Installed, you are ready to go. We will start with a “Simple Web Application” . I hope you have a created a new web application and added your license as suggested before. Now create a page.</p>
<p>So your page will be looking as follows.</p>
<p>[html]<br />
&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;Default.aspx.cs&quot; Inherits=&quot;UsingSpirePDF.Default&quot; %&gt;</p>
<p>&lt;!DOCTYPE html&gt;</p>
<p>&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
&lt;head runat=&quot;server&quot;&gt;<br />
    &lt;title&gt;&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;<br />
    &lt;div&gt;</p>
<p>    &lt;/div&gt;<br />
    &lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>Now right click on your project and click add reference, in the browse tab find out the folder in which you have installed spire.pdf. Usually it will be in the C:\Program Files\e-iceblue\Spire.pdf. Now just find your framework version from BIN folder and add Spire.pdf.dll</p>
<div id="attachment_10241" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Reference-e1440429536607.png"><img decoding="async" aria-describedby="caption-attachment-10241" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Reference-e1440429536607.png" alt="Using_Spire_PDF_Adding_Reference" width="650" height="447" class="size-full wp-image-10241" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Reference-e1440429536607.png 650w, /wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Reference-e1440429536607-300x206.png 300w, /wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Reference-e1440429536607-160x110.png 160w, /wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Reference-e1440429536607-400x275.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10241" class="wp-caption-text">Using_Spire_PDF_Adding_Reference</p></div>
<p>Now we have added reference too. So shall we start coding ?</p>
<p><strong>Using the code</strong></p>
<p>There are so many features available, we will look in to most useful features which you might found useful.</p>
<p><strong>Convert PDF Page to Image</strong></p>
<p>In this part, we will see how can we convert a PDF file to image with a specific resolution. It is so simple and powerful.</p>
<p>We will create a button as follows.</p>
<p>[html]<br />
&lt;asp:Button ID=&quot;btnConvertToImage&quot; runat=&quot;server&quot; Text=&quot;Convert To Image&quot; /&gt;<br />
[/html]</p>
<p>Next we need to add the needed references.</p>
<p>[csharp]<br />
using Spire.Pdf;<br />
using Spire.Pdf.Graphics;<br />
using System;<br />
using System.Drawing;<br />
[/csharp]</p>
<p>And in the button click we can write the preceding codes.</p>
<p>[csharp]<br />
 protected void btnConvertToImage_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                PdfDocument documemt = new PdfDocument();<br />
                documemt.LoadFromFile(@&quot;D:\\sibeeshpassion.pdf&quot;);<br />
                Image image = documemt.SaveAsImage(0, PdfImageType.Bitmap, 400, 400);<br />
                image.Save(@&quot;D:\\result.jpg&quot;);<br />
                documemt.Close();<br />
            }<br />
            catch (Exception)<br />
            {</p>
<p>                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p>As you can see we are calling the below function to generate the image.</p>
<p>[csharp]<br />
documemt.SaveAsImage(0, PdfImageType.Bitmap, 400, 400);<br />
[/csharp]</p>
<p>And this function has overloaded as in the below image.</p>
<div id="attachment_10251" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image.png"><img decoding="async" aria-describedby="caption-attachment-10251" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image-e1440431907162.png" alt="Using_Spire_PDF_Covert_PDF_To_Image" width="650" height="97" class="size-full wp-image-10251" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image-e1440431907162.png 650w, /wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image-e1440431907162-300x45.png 300w, /wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image-e1440431907162-400x60.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10251" class="wp-caption-text">Using_Spire_PDF_Covert_PDF_To_Image</p></div>
<p>Here we are taking the pdf file <em><a href="http://sibeeshpassion.com/download/sibeeshpassion.pdf" target="_blank" rel="noopener">sibeeshpassion.pdf</a></em> and we are getting a image as follows as output. </p>
<div id="attachment_10261" style="width: 520px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image_Output.png"><img decoding="async" aria-describedby="caption-attachment-10261" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image_Output.png" alt="Using_Spire_PDF_Covert_PDF_To_Image_Output" width="510" height="724" class="size-full wp-image-10261" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image_Output.png 251w, /wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image_Output-211x300.png 211w, /wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image_Output-400x568.png 400w, /wp-content/uploads/2015/08/Using_Spire_PDF_Covert_PDF_To_Image_Output-423x600.png 423w" sizes="(max-width: 510px) 100vw, 510px" /></a><p id="caption-attachment-10261" class="wp-caption-text">Using_Spire_PDF_Covert_PDF_To_Image_Output</p></div>
<p>Cool Right?</p>
<p>Now we will see another implementation.</p>
<p><strong>Security</strong></p>
<p>There are few many security options are also available with this package like Encryption and Decryption of the pdf file and creating a digital signature and many more.</p>
<p><strong>Encrypting PDF File</strong></p>
<p>In this step, we are going to set a password for our pdf document.</p>
<p>To work with security, you need to add a new reference as follows.</p>
<p>[csharp]<br />
using Spire.Pdf.Security;<br />
[/csharp]</p>
<p>Now add a new button as follows.</p>
<p>[html]<br />
&lt;asp:Button ID=&quot;btnEncryptPDF&quot; runat=&quot;server&quot; Text=&quot;Encrypt PDF&quot; OnClick=&quot;btnEncryptPDF_Click&quot;/&gt;<br />
[/html]</p>
<p>Now it is time for click event.</p>
<p>[csharp]<br />
protected void btnEncryptPDF_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                PdfDocument doc = new PdfDocument(@&quot;D:\\sibeeshpassion.pdf&quot;, &quot;sibeeshpassionEncrypted&quot;);<br />
                doc.Security.KeySize = PdfEncryptionKeySize.Key256Bit;<br />
                doc.Security.OwnerPassword = &quot;sibeeshpassion&quot;;<br />
                doc.Security.UserPassword = &quot;sibeesh&quot;;<br />
                doc.Security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.CopyContent;<br />
            }<br />
            catch (Exception)<br />
            {</p>
<p>                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p>Three kind of pdf key size are available as shown in the below image.</p>
<div id="attachment_10271" style="width: 663px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Possible_Key.png"><img decoding="async" aria-describedby="caption-attachment-10271" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Possible_Key.png" alt="Using_Spire_PDF_Possible_Key" width="653" height="108" class="size-full wp-image-10271" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Possible_Key.png 653w, /wp-content/uploads/2015/08/Using_Spire_PDF_Possible_Key-300x50.png 300w, /wp-content/uploads/2015/08/Using_Spire_PDF_Possible_Key-400x66.png 400w" sizes="(max-width: 653px) 100vw, 653px" /></a><p id="caption-attachment-10271" class="wp-caption-text">Using_Spire_PDF_Possible_Key</p></div>
<p>And as you can see, we are setting some permission by using the preceding code.</p>
<p>[csharp]<br />
 doc.Security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.CopyContent;<br />
[/csharp]</p>
<p>There are some other permission options also available.</p>
<div id="attachment_10281" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Possible_File_Permissions-e1440433409566.png"><img decoding="async" aria-describedby="caption-attachment-10281" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Possible_File_Permissions-e1440433409566.png" alt="Using_Spire_PDF_Possible_File_Permissions" width="650" height="244" class="size-full wp-image-10281" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Possible_File_Permissions-e1440433409566.png 650w, /wp-content/uploads/2015/08/Using_Spire_PDF_Possible_File_Permissions-e1440433409566-300x113.png 300w, /wp-content/uploads/2015/08/Using_Spire_PDF_Possible_File_Permissions-e1440433409566-400x150.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10281" class="wp-caption-text">Using_Spire_PDF_Possible_File_Permissions</p></div>
<p>Now if you try to open our pdf again, it will ask you for a password which we have set in the above codes. Cool.</p>
<p><strong>Decryption of PDF File</strong></p>
<p>AS we encrypt our pdf file, we need to do decryption also right?</p>
<p>Add an another button.</p>
<p>[html]<br />
&lt;asp:Button ID=&quot;btnDecrypt&quot; runat=&quot;server&quot; Text=&quot;Decrypt PDF&quot; OnClick=&quot;btnDecrypt_Click&quot; /&gt;<br />
[/html] </p>
<p>Add the following code block in the button click event.</p>
<p>[csharp]<br />
try<br />
            {<br />
                PdfDocument doc = new PdfDocument(@&quot;D:\\sibeeshpassion.pdf&quot;, &quot;sibeeshpassionEncrypted&quot;);<br />
                //extract image<br />
                Image image = doc.Pages[0].ImagesInfo[0].Image;<br />
                doc.Close();<br />
                //Save image file.<br />
                image.Save(&quot;sibeeshpassionDecrypted.png&quot;, System.Drawing.Imaging.ImageFormat.Png);<br />
                //Launching the image file.<br />
                System.Diagnostics.Process.Start(&quot;sibeeshpassionDecrypted.png&quot;);</p>
<p>            }<br />
            catch (Exception ex)<br />
            {</p>
<p>                throw;<br />
            }<br />
[/csharp]</p>
<p>Once you run the above codes, your pdf file will be decrypted.</p>
<p><strong>Watermark</strong></p>
<p>You can add watermark to your pdf file easily with this package. </p>
<p><strong>Adding a watermark</strong></p>
<p>There are two kind of watermarks. One is text watermark and other is image watermark.</p>
<p>Now we will add another button.</p>
<p>[html]<br />
&lt;asp:Button ID=&quot;btnAddImageWatermark&quot; runat=&quot;server&quot; Text=&quot;Add Image Watermark&quot; OnClick=&quot;btnAddImageWatermark_Click&quot;  /&gt;<br />
[/html]</p>
<p>And in the button click we can write the preceding codes.</p>
<p>[csharp]<br />
protected void btnAddImageWatermark_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                PdfDocument doc = new PdfDocument(&quot;D:\\Sibi.pdf&quot;, &quot;Sibi&quot;);<br />
                Image img = Image.FromFile(&quot;D:\\sibi.jpg&quot;);<br />
                doc.Pages[0].BackgroundImage = img;<br />
                doc.SaveToFile(&quot;D:\\Sibeesh.pdf&quot;);<br />
                doc.Close();</p>
<p>            }<br />
            catch (Exception)<br />
            {</p>
<p>                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p>As you can see we are taking a pdf file and add a watermark image to the file and at last we save it to an another file. In this case from sibi.pdf to sibeesh.pdf.</p>
<p>I am taking <a href="http://sibeeshpassion.com/content/images/sibi.jpg" target="_blank" rel="noopener">sibi.jpg</a> as the water mark image, so you can see the pdf file with watermarked image as follows.</p>
<div id="attachment_10311" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Watermark-e1440437182738.png"><img decoding="async" aria-describedby="caption-attachment-10311" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Watermark-e1440437182738.png" alt="Using_Spire_PDF_Adding_Watermark" width="650" height="601" class="size-full wp-image-10311" srcset="/wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Watermark-e1440437182738.png 650w, /wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Watermark-e1440437182738-300x277.png 300w, /wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Watermark-e1440437182738-400x370.png 400w, /wp-content/uploads/2015/08/Using_Spire_PDF_Adding_Watermark-e1440437182738-649x600.png 649w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10311" class="wp-caption-text">Using_Spire_PDF_Adding_Watermark</p></div>
<p><em>Please be noted that, you can convert your PDF file to any other file format, there are plenty of options available. Please try that too. I have given only few options which I use always.</em></p>
<p><strong>Conclusion</strong></p>
<p>These are the features I loved using Spire.PDF. It is much effective and simple. What do you think about this? Are you using Spire.PDF yet? Do you plan to try this?Did I miss anything that you may think which is needed?. I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn&#8217;t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you&#8217;re better off posting it on Stack Overflow instead of commenting here. Tweet or email me a link to your question there and I&#8217;ll definitely try to help if I am able to.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/using-spire-pdf-in-asp-net/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Working With Charts Using Spire.XLS</title>
		<link>https://mail.sibeeshpassion.com/working-with-charts-using-spire-xls/</link>
					<comments>https://mail.sibeeshpassion.com/working-with-charts-using-spire-xls/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 11 Aug 2015 15:45:19 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Spire.XLS]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[Charts Using Spire.XLS]]></category>
		<category><![CDATA[Column Charts]]></category>
		<category><![CDATA[Pie Charts]]></category>
		<category><![CDATA[Save Excel Charts as Images]]></category>
		<category><![CDATA[Spire.XLs]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=8751</guid>

					<description><![CDATA[Today we are going to see an another series of new product Spire.XLS which helps us to create, manipulate, convert EXCEL file to other formats, create charts dynamically and many more. This product has been introduced by the company E-Iceblue. I hope you have read my article of Spire.Doc and Spire.XLS. If you have not read it, I recommend you to read it here: Using Spire.XLS Background As you all know, charts are the graphical representations of our data. It is much easier to understand our data if it is in a graphical form. Am I right? It is easy [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Today we are going to see an another series of new product <em>Spire.XLS</em> which helps us to create, manipulate, convert EXCEL file to other formats, create charts dynamically and many more. This product has been introduced by the company <a href="http://www.e-iceblue.com/" target="_blank" rel="noopener">E-Iceblue</a>. I hope you have read my article of <em>Spire.Doc</em> and <em>Spire.XLS</em>. If you have not read it, I recommend you to read it here: <a href="http://sibeeshpassion.com/using-spire-xls/" target="_blank" rel="noopener">Using Spire.XLS</a></p>
<p><strong>Background</strong></p>
<p>As you all know, charts are the graphical representations of our data. It is much easier to understand our data if it is in a graphical form. Am I right? It is easy to create a static chart, but what about a dynamic one? It will be bit tough right? But by using Spire.XLS, we can create any kind of charts easily. In this post, we will see those implementations. </p>
<p><strong>Download the files</strong></p>
<p>You can always get the needed files from here: <a href="http://www.e-iceblue.com/Download/download-excel-for-net-now.html" target="_blank" rel="noopener">Download Spire.XLS</a></p>
<p><strong>Install Spire.XLS</strong></p>
<p>I am using evaluation version with one month temporary license. There are free versions also available for spire.xls with some limitation. You can try that. Now click on the exe file after you extract the downloaded file. The installation will get started then.</p>
<p><img decoding="async" src="http://sibeeshpassion.com/content/images/InstallSpireXls.png" alt="Using Spire XLS" /></p>
<p><strong>Using the code</strong></p>
<p>Before starting with coding you need to add the needed namespaces as follows.</p>
<p>[csharp]<br />
using Spire.Xls;<br />
using System.Drawing;<br />
[/csharp]</p>
<p>First of all create a form and then a button, in the button click add the following lines of codes.</p>
<p><strong>C# Code</strong></p>
<p>[csharp]<br />
  private void button1_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                //Create a new workbook<br />
                Workbook workbook = new Workbook();<br />
                //Initialize worksheet<br />
                workbook.CreateEmptySheets(1);<br />
                Worksheet sheet = workbook.Worksheets[0];<br />
                //Set sheet name<br />
                sheet.Name = &quot;Chart data&quot;;<br />
                //Set the grid lines invisible<br />
                sheet.GridLinesVisible = false;<br />
                //Create a chart<br />
                Chart chart = sheet.Charts.Add(ExcelChartType.Pie3D);<br />
                //Set region of chart data<br />
                chart.DataRange = sheet.Range[&quot;B2:B5&quot;];<br />
                chart.SeriesDataFromRange = false;<br />
                //Set position of chart<br />
                chart.LeftColumn = 1;<br />
                chart.TopRow = 6;<br />
                chart.RightColumn = 9;<br />
                chart.BottomRow = 25;<br />
                //Chart title<br />
                chart.ChartTitle = &quot;Sales by year&quot;;<br />
                chart.ChartTitleArea.IsBold = true;<br />
                chart.ChartTitleArea.Size = 12;<br />
                //Initialize the chart series<br />
                Spire.Xls.Charts.ChartSerie cs = chart.Series[0];<br />
                //Chart Labels resource<br />
                cs.CategoryLabels = sheet.Range[&quot;A2:A5&quot;];<br />
                //Chart value resource<br />
                cs.Values = sheet.Range[&quot;B2:B5&quot;];<br />
                //Set the value visible in the chart<br />
                cs.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;<br />
                //Year<br />
                sheet.Range[&quot;A1&quot;].Value = &quot;Year&quot;;<br />
                sheet.Range[&quot;A2&quot;].Value = &quot;2002&quot;;<br />
                sheet.Range[&quot;A3&quot;].Value = &quot;2003&quot;;<br />
                sheet.Range[&quot;A4&quot;].Value = &quot;2004&quot;;<br />
                sheet.Range[&quot;A5&quot;].Value = &quot;2005&quot;;<br />
                //Sales<br />
                sheet.Range[&quot;B1&quot;].Value = &quot;Sales&quot;;<br />
                sheet.Range[&quot;B2&quot;].NumberValue = 4000;<br />
                sheet.Range[&quot;B3&quot;].NumberValue = 6000;<br />
                sheet.Range[&quot;B4&quot;].NumberValue = 7000;<br />
                sheet.Range[&quot;B5&quot;].NumberValue = 8500;<br />
                //Style<br />
                sheet.Range[&quot;A1:B1&quot;].Style.Font.IsBold = true;<br />
                sheet.Range[&quot;A2:B2&quot;].Style.KnownColor = ExcelColors.LightYellow;<br />
                sheet.Range[&quot;A3:B3&quot;].Style.KnownColor = ExcelColors.LightGreen1;<br />
                sheet.Range[&quot;A4:B4&quot;].Style.KnownColor = ExcelColors.LightOrange;<br />
                sheet.Range[&quot;A5:B5&quot;].Style.KnownColor = ExcelColors.LightTurquoise;<br />
                //Border<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeTop].Color = Color.FromArgb(0, 0, 128);<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeTop].LineStyle = LineStyleType.Thin;<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeBottom].Color = Color.FromArgb(0, 0, 128);<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeLeft].Color = Color.FromArgb(0, 0, 128);<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeLeft].LineStyle = LineStyleType.Thin;<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeRight].Color = Color.FromArgb(0, 0, 128);<br />
                sheet.Range[&quot;A1:B5&quot;].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;<br />
                //Number format<br />
                sheet.Range[&quot;B2:C5&quot;].Style.NumberFormat = &quot;\&quot;$\&quot;#,##0&quot;;<br />
                chart.PlotArea.Fill.Visible = false;<br />
                //Save the file<br />
                workbook.SaveToFile(&quot;Sample.xls&quot;);<br />
                //Launch the file<br />
                System.Diagnostics.Process.Start(&quot;Sample.xls&quot;);<br />
            }<br />
            catch (Exception)<br />
            {</p>
<p>                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p><strong>VB.NET Code</strong></p>
<p>[vb]<br />
 &#8216;Create a new workbook<br />
        Dim workbook As New Workbook()<br />
        &#8216;Initialize worksheet<br />
        workbook.CreateEmptySheets(1)<br />
        Dim sheet As Worksheet = workbook.Worksheets(0)<br />
        &#8216;Set sheet name<br />
        sheet.Name = &quot;Chart data&quot;<br />
        &#8216;Set the grid lines invisible<br />
        sheet.GridLinesVisible = False<br />
        &#8216;Create a chart<br />
        Dim chart As Chart = sheet.Charts.Add(ExcelChartType.Pie3D)<br />
        &#8216;Set region of chart data<br />
        chart.DataRange = sheet.Range(&quot;B2:B5&quot;)<br />
        chart.SeriesDataFromRange = False<br />
        &#8216;Set position of chart<br />
        chart.LeftColumn = 1<br />
        chart.TopRow = 6<br />
        chart.RightColumn = 9<br />
        chart.BottomRow = 25<br />
        &#8216;Chart title<br />
        chart.ChartTitle = &quot;Sales by year&quot;<br />
        chart.ChartTitleArea.IsBold = True<br />
        chart.ChartTitleArea.Size = 12<br />
        &#8216;Set the chart<br />
        Dim cs As Spire.Xls.Charts.ChartSerie = chart.Series(0)<br />
        &#8216;Chart Labels resource<br />
        cs.CategoryLabels = sheet.Range(&quot;A2:A5&quot;)<br />
        &#8216;Chart value resource<br />
        cs.Values = sheet.Range(&quot;B2:B5&quot;)<br />
        &#8216;Set the value visible in the chart<br />
        cs.DataPoints.DefaultDataPoint.DataLabels.HasValue = True<br />
        &#8216;Year<br />
        sheet.Range(&quot;A1&quot;).Value = &quot;Year&quot;<br />
        sheet.Range(&quot;A2&quot;).Value = &quot;2002&quot;<br />
        sheet.Range(&quot;A3&quot;).Value = &quot;2003&quot;<br />
        sheet.Range(&quot;A4&quot;).Value = &quot;2004&quot;<br />
        sheet.Range(&quot;A5&quot;).Value = &quot;2005&quot;<br />
        &#8216;Sales<br />
        sheet.Range(&quot;B1&quot;).Value = &quot;Sales&quot;<br />
        sheet.Range(&quot;B2&quot;).NumberValue = 4000<br />
        sheet.Range(&quot;B3&quot;).NumberValue = 6000<br />
        sheet.Range(&quot;B4&quot;).NumberValue = 7000<br />
        sheet.Range(&quot;B5&quot;).NumberValue = 8500<br />
        &#8216;Style<br />
        sheet.Range(&quot;A1:B1&quot;).Style.Font.IsBold = True<br />
        sheet.Range(&quot;A2:B2&quot;).Style.KnownColor = ExcelColors.LightYellow<br />
        sheet.Range(&quot;A3:B3&quot;).Style.KnownColor = ExcelColors.LightGreen1<br />
        sheet.Range(&quot;A4:B4&quot;).Style.KnownColor = ExcelColors.LightOrange<br />
        sheet.Range(&quot;A5:B5&quot;).Style.KnownColor = ExcelColors.LightTurquoise<br />
        &#8216;Border<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeTop).Color = Color.FromArgb(0, 0, 128)<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeTop).LineStyle = LineStyleType.Thin<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeBottom).Color = Color.FromArgb(0, 0, 128)<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeBottom).LineStyle = LineStyleType.Thin<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeLeft).Color = Color.FromArgb(0, 0, 128)<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeLeft).LineStyle = LineStyleType.Thin<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeRight).Color = Color.FromArgb(0, 0, 128)<br />
        sheet.Range(&quot;A1:B5&quot;).Style.Borders(BordersLineType.EdgeRight).LineStyle = LineStyleType.Thin<br />
        &#8216;Number format<br />
        sheet.Range(&quot;B2:C5&quot;).Style.NumberFormat = &quot;&quot;&quot;$&quot;&quot;#,##0&quot;<br />
        chart.PlotArea.Fill.Visible = False<br />
        &#8216;Save doc file.<br />
        workbook.SaveToFile(&quot;Sample.xls&quot;)<br />
        &#8216;Launch the MS Word file.<br />
        System.Diagnostics.Process.Start(&quot;Sample.xls&quot;)<br />
[/vb]</p>
<p>In the above lines code, we are creating a pie chart by giving some settings and data and load it. Now if you run you will get an output as follows.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541.png" alt="Create_Charts_Using_SpireXLS" width="650" height="261" class="alignnone size-full wp-image-8761" srcset="/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541.png 650w, /wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541-300x120.png 300w, /wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS-e1439222337541-400x161.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output.png" alt="Create_Charts_Using_SpireXLS_Output" width="581" height="510" class="alignnone size-full wp-image-8771" srcset="/wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output.png 581w, /wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output-300x263.png 300w, /wp-content/uploads/2015/08/Create_Charts_Using_SpireXLS_Output-400x351.png 400w" sizes="(max-width: 581px) 100vw, 581px" /></a></p>
<p>In the above mentioned lines of codes, we are doing so many processes, those processes are listed below.</p>
<li>Creating a new workbook</li>
<li>Initialize worksheet newly created</li>
<li>Set sheet name of worksheet</li>
<li>Set the grid lines invisible</li>
<li>Creating a chart</li>
<li>Set region of chart data</li>
<li>Set position of chart</li>
<li>Set Chart title</li>
<li>Initialize the chart series</li>
<li>Setting Chart Labels resource</li>
<li>Setting Chart value resource</li>
<li>Set the value visible in the chart</li>
<li>Apply Styles</li>
<li>Apply Borders</li>
<li>Give Number format if necessary</li>
<li>Save the file</li>
<li>At last Launch the file</li>
<p>Wow!. That&#8217;s cool right?</p>
<p>Not yet finished!. There are so many things you can try with your sheet object. I suggest you to try those. You will get surprised.</p>
<div id="attachment_10031" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956.png"><img decoding="async" aria-describedby="caption-attachment-10031" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956.png" alt="Working With Charts Using Spire XLS Sheet Object" width="650" height="233" class="size-full wp-image-10031" srcset="/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956.png 650w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956-300x108.png 300w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire-e1440082383956-400x143.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10031" class="wp-caption-text">Working With Charts Using Spire XLS Sheet Object</p></div>
<div id="attachment_10041" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977.png"><img decoding="async" aria-describedby="caption-attachment-10041" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977.png" alt="Working With Charts Using Spire XLS Sheet Object" width="650" height="270" class="size-full wp-image-10041" srcset="/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977.png 650w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977-300x125.png 300w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire1-e1440082428977-400x166.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10041" class="wp-caption-text">Working With Charts Using Spire XLS Sheet Object</p></div>
<p>If you want you can set different chart types too, it will give you a great design in your chart. The most useful chart types which I uses is Bar3DClustered, 3DBubble, Bubble, Column3D and many more.</p>
<div id="attachment_10051" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object.png"><img decoding="async" aria-describedby="caption-attachment-10051" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object-e1440082676189.png" alt="Working_With_Charts_Using_Spire_XLS_Chart_Object" width="650" height="195" class="size-full wp-image-10051" srcset="/wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object-e1440082676189.png 650w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object-e1440082676189-300x90.png 300w, /wp-content/uploads/2015/08/Working_With_Charts_Using_Spire_XLS_Chart_Object-e1440082676189-400x120.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10051" class="wp-caption-text">Working_With_Charts_Using_Spire_XLS_Chart_Object</p></div>
<p>This product gives you many ways to make your chart in the way you like. There are plenty of options available to so so like you can set the Legend Position by using LegendPositionType property.</p>
<p>Next we will see how we can implement Column chart, what ever we have discusses will be same for every charts, but it may have some different properties which is strictly depends on the chart type. </p>
<p><strong>Column Chart</strong></p>
<p>Now we will create an another button and name it Column Chart. And in the button click you need to add the following codes.</p>
<p><strong>C# Code</strong></p>
<p>[csharp]<br />
private void button2_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                //Load Workbook<br />
                Workbook workbook = new Workbook();<br />
                workbook.LoadFromFile(@&quot;D:\Sample.xlsx&quot;);<br />
                Worksheet sheet = workbook.Worksheets[0];<br />
                //Add Chart and Set Chart Data Range<br />
                Chart chart = sheet.Charts.Add(ExcelChartType.ColumnClustered);<br />
                chart.DataRange = sheet.Range[&quot;D1:E17&quot;];<br />
                chart.SeriesDataFromRange = false;<br />
                //Chart Position<br />
                chart.LeftColumn = 1;<br />
                chart.TopRow = 19;<br />
                chart.RightColumn = 8;<br />
                chart.BottomRow = 33;<br />
                //Chart Border<br />
                chart.ChartArea.Border.Weight = ChartLineWeightType.Medium;<br />
                chart.ChartArea.Border.Color = Color.SandyBrown;<br />
                //Chart Title<br />
                chart.ChartTitle = &quot;Parts Sales Info&quot;;<br />
                chart.ChartTitleArea.Font.FontName = &quot;Calibri&quot;;<br />
                chart.ChartTitleArea.Font.Size = 13;<br />
                chart.ChartTitleArea.Font.IsBold = true;<br />
                //Chart Axes<br />
                chart.PrimaryCategoryAxis.Title = &quot;Parts&quot;;<br />
                chart.PrimaryCategoryAxis.Font.Color = Color.Blue;<br />
                chart.PrimaryValueAxis.Title = &quot;Amounts&quot;;<br />
                chart.PrimaryValueAxis.HasMajorGridLines = false;<br />
                chart.PrimaryValueAxis.MaxValue = 350;<br />
                chart.PrimaryValueAxis.TitleArea.TextRotationAngle = 90;<br />
                //Chart Legend<br />
                chart.Legend.Position = LegendPositionType.Right;<br />
                //Save and Launch<br />
                workbook.SaveToFile(&quot;ExcelColumnChart.xlsx&quot;, ExcelVersion.Version2010);<br />
                System.Diagnostics.Process.Start(&quot;ExcelColumnChart.xlsx&quot;);</p>
<p>            }<br />
            catch (Exception)<br />
            {</p>
<p>                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p><strong>VB.NET Code</strong></p>
<p>[vb]<br />
 &#8216;Load Workbook<br />
            Dim workbook As New Workbook()<br />
            workbook.LoadFromFile(&quot;E:\Sample.xlsx&quot;)<br />
            Dim sheet As Worksheet = workbook.Worksheets(0)<br />
            &#8216;Add Chart and Set Chart Data Range<br />
            Dim chart As Chart = sheet.Charts.Add(ExcelChartType.ColumnClustered)<br />
            chart.DataRange = sheet.Range(&quot;D1:E17&quot;)<br />
            chart.SeriesDataFromRange = False<br />
            &#8216;Chart Position<br />
            chart.LeftColumn = 1<br />
            chart.TopRow = 19<br />
            chart.RightColumn = 8<br />
            chart.BottomRow = 33<br />
            &#8216;Chart Border<br />
            chart.ChartArea.Border.Weight = ChartLineWeightType.Medium<br />
            chart.ChartArea.Border.Color = Color.SandyBrown<br />
            &#8216;Chart Title<br />
            chart.ChartTitle = &quot;Parts Sales Info&quot;<br />
            chart.ChartTitleArea.Font.FontName = &quot;Calibri&quot;<br />
            chart.ChartTitleArea.Font.Size = 13<br />
            chart.ChartTitleArea.Font.IsBold = True<br />
            &#8216;Chart Axes<br />
            chart.PrimaryCategoryAxis.Title = &quot;Parts&quot;<br />
            chart.PrimaryCategoryAxis.Font.Color = Color.Blue<br />
            chart.PrimaryValueAxis.Title = &quot;Amounts&quot;<br />
            chart.PrimaryValueAxis.HasMajorGridLines = False<br />
            chart.PrimaryValueAxis.MaxValue = 350<br />
            chart.PrimaryValueAxis.TitleArea.TextRotationAngle = 90<br />
            &#8216;Chart Legend<br />
            chart.Legend.Position = LegendPositionType.Right<br />
            &#8216;Save and Launch<br />
            workbook.SaveToFile(&quot;ExcelColumnChart.xlsx&quot;, ExcelVersion.Version2010)<br />
            System.Diagnostics.Process.Start(&quot;ExcelColumnChart.xlsx&quot;)</p>
<p>[/vb]</p>
<p>Now if you run the code, you can see an output as follows.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/columnchart-e1439304127270.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/columnchart-e1439304127270.png" alt="columnchart" width="650" height="398" class="alignnone size-full wp-image-9061" srcset="/wp-content/uploads/2015/08/columnchart-e1439304127270.png 650w, /wp-content/uploads/2015/08/columnchart-e1439304127270-300x184.png 300w, /wp-content/uploads/2015/08/columnchart-e1439304127270-400x245.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p><strong>Excel Bar Chart</strong></p>
<p>Before going through you must add an new namespace as follows.</p>
<p>[csharp]<br />
using Spire.Xls.Charts;<br />
[/csharp]<br />
Now we will create an another button in our form and in the click event we will write the receding lines of codes.</p>
<p>[csharp]<br />
  private void button1_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                Workbook workbook = new Workbook();<br />
                //Initailize worksheet<br />
                workbook.CreateEmptySheets(1);<br />
                Worksheet sheet = workbook.Worksheets[0];<br />
                sheet.Name = &quot;Chart data&quot;;<br />
                sheet.GridLinesVisible = false;<br />
                //Writes chart data<br />
                CreateChartData(sheet);<br />
                //Add a new  chart worsheet to workbook<br />
                Chart chart = sheet.Charts.Add();<br />
                //Set region of chart data<br />
                chart.DataRange = sheet.Range[&quot;A1:C5&quot;];<br />
                chart.SeriesDataFromRange = false;<br />
                //Set position of chart<br />
                chart.LeftColumn = 1;<br />
                chart.TopRow = 6;<br />
                chart.RightColumn = 11;<br />
                chart.BottomRow = 29;<br />
                chart.ChartType = ExcelChartType.Bar3DClustered;<br />
                //Chart title<br />
                chart.ChartTitle = &quot;Sales market by country&quot;;<br />
                chart.ChartTitleArea.IsBold = true;<br />
                chart.ChartTitleArea.Size = 12;<br />
                chart.PrimaryCategoryAxis.Title = &quot;Country&quot;;<br />
                chart.PrimaryCategoryAxis.Font.IsBold = true;<br />
                chart.PrimaryCategoryAxis.TitleArea.IsBold = true;<br />
                chart.PrimaryCategoryAxis.TitleArea.TextRotationAngle = 90;<br />
                chart.PrimaryValueAxis.Title = &quot;Sales(in Dollars)&quot;;<br />
                chart.PrimaryValueAxis.HasMajorGridLines = false;<br />
                chart.PrimaryValueAxis.MinValue = 1000;<br />
                chart.PrimaryValueAxis.TitleArea.IsBold = true;<br />
                foreach (ChartSerie cs in chart.Series)<br />
                {<br />
                    cs.Format.Options.IsVaryColor = true;<br />
                    cs.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;<br />
                }<br />
                chart.Legend.Position = LegendPositionType.Top;<br />
                workbook.SaveToFile(&quot;Sample.xls&quot;);<br />
                ExcelDocViewer(workbook.FileName);</p>
<p>            }<br />
            catch (Exception)<br />
            {<br />
                throw;<br />
            }<br />
        }<br />
[/csharp]</p>
<p>As you can see we are calling a function <em>CreateChartData</em> to generate the data, so now we will write the function body.</p>
<p>[csharp]<br />
private void CreateChartData(Worksheet sheet)<br />
        {<br />
            //Country<br />
            sheet.Range[&quot;A1&quot;].Value = &quot;Country&quot;;<br />
            sheet.Range[&quot;A2&quot;].Value = &quot;Cuba&quot;;<br />
            sheet.Range[&quot;A3&quot;].Value = &quot;Mexico&quot;;<br />
            sheet.Range[&quot;A4&quot;].Value = &quot;France&quot;;<br />
            sheet.Range[&quot;A5&quot;].Value = &quot;German&quot;;<br />
            //Jun<br />
            sheet.Range[&quot;B1&quot;].Value = &quot;Jun&quot;;<br />
            sheet.Range[&quot;B2&quot;].NumberValue = 6000;<br />
            sheet.Range[&quot;B3&quot;].NumberValue = 8000;<br />
            sheet.Range[&quot;B4&quot;].NumberValue = 9000;<br />
            sheet.Range[&quot;B5&quot;].NumberValue = 8500;<br />
            //Jun<br />
            sheet.Range[&quot;C1&quot;].Value = &quot;Aug&quot;;<br />
            sheet.Range[&quot;C2&quot;].NumberValue = 3000;<br />
            sheet.Range[&quot;C3&quot;].NumberValue = 2000;<br />
            sheet.Range[&quot;C4&quot;].NumberValue = 2300;<br />
            sheet.Range[&quot;C5&quot;].NumberValue = 4200;<br />
            //Style<br />
            sheet.Range[&quot;A1:C1&quot;].Style.Font.IsBold = true;<br />
            sheet.Range[&quot;A2:C2&quot;].Style.KnownColor = ExcelColors.LightYellow;<br />
            sheet.Range[&quot;A3:C3&quot;].Style.KnownColor = ExcelColors.LightGreen1;<br />
            sheet.Range[&quot;A4:C4&quot;].Style.KnownColor = ExcelColors.LightOrange;<br />
            sheet.Range[&quot;A5:C5&quot;].Style.KnownColor = ExcelColors.LightTurquoise;<br />
            //Border<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeTop].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeTop].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeBottom].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeLeft].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeLeft].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeRight].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;B2:C5&quot;].Style.NumberFormat = &quot;\&quot;$\&quot;#,##0&quot;;<br />
        }<br />
[/csharp]</p>
<p>And we will use the preceding function for viewing our chart created.</p>
<p>[csharp]<br />
private void ExcelDocViewer(string fileName)<br />
        {<br />
            try<br />
            {<br />
                System.Diagnostics.Process.Start(fileName);<br />
            }<br />
            catch { }<br />
        }<br />
[/csharp]</p>
<p>Now it is time to run our program. You will see the output as follows.</p>
<div id="attachment_9071" style="width: 310px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Excel_Bar_Chart.png"><img decoding="async" aria-describedby="caption-attachment-9071" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Excel_Bar_Chart.png" alt="Excel Bar Chart" width="300" height="300" class="size-full wp-image-9071" srcset="/wp-content/uploads/2015/08/Excel_Bar_Chart.png 300w, /wp-content/uploads/2015/08/Excel_Bar_Chart-150x150.png 150w, /wp-content/uploads/2015/08/Excel_Bar_Chart-130x130.png 130w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-9071" class="wp-caption-text">Excel Bar Chart</p></div>
<div id="attachment_9081" style="width: 669px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Excel_Bar_Chart_Output.png"><img decoding="async" aria-describedby="caption-attachment-9081" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Excel_Bar_Chart_Output.png" alt="Excel Bar Chart " width="659" height="458" class="size-full wp-image-9081" srcset="/wp-content/uploads/2015/08/Excel_Bar_Chart_Output.png 659w, /wp-content/uploads/2015/08/Excel_Bar_Chart_Output-300x208.png 300w, /wp-content/uploads/2015/08/Excel_Bar_Chart_Output-160x110.png 160w, /wp-content/uploads/2015/08/Excel_Bar_Chart_Output-400x278.png 400w" sizes="(max-width: 659px) 100vw, 659px" /></a><p id="caption-attachment-9081" class="wp-caption-text">Excel Bar Chart</p></div>
<p>As you can see it is very easy to give styles and border to our chart.</p>
<p>[csharp]<br />
//Style<br />
            sheet.Range[&quot;A1:C1&quot;].Style.Font.IsBold = true;<br />
            sheet.Range[&quot;A2:C2&quot;].Style.KnownColor = ExcelColors.LightYellow;<br />
            sheet.Range[&quot;A3:C3&quot;].Style.KnownColor = ExcelColors.LightGreen1;<br />
            sheet.Range[&quot;A4:C4&quot;].Style.KnownColor = ExcelColors.LightOrange;<br />
            sheet.Range[&quot;A5:C5&quot;].Style.KnownColor = ExcelColors.LightTurquoise;<br />
            //Border<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeTop].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeTop].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeBottom].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeLeft].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeLeft].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeRight].Color = Color.FromArgb(0, 0, 128);<br />
            sheet.Range[&quot;A1:C5&quot;].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;<br />
            sheet.Range[&quot;B2:C5&quot;].Style.NumberFormat = &quot;\&quot;$\&quot;#,##0&quot;;<br />
[/csharp]</p>
<p>Like this we can crate Line Chart, Radar Chart and many more. Please try those too. Now we will see How to Save Excel Charts as Images.</p>
<p><strong>How to Save Excel Charts as Images</strong></p>
<p>Create another button and write the preceding codes in button click.</p>
<p>[csharp]<br />
private void button2_Click(object sender, EventArgs e)<br />
        {<br />
            Workbook workbook = new Workbook();<br />
            workbook.LoadFromFile(&quot;D:\\Sample.xlsx&quot;, ExcelVersion.Version2010);<br />
            Worksheet sheet = workbook.Worksheets[0];<br />
            Image[] imgs = workbook.SaveChartAsImage(sheet);<br />
            for (int i = 0; i &lt; imgs.Length; i++)<br />
            {<br />
                imgs[i].Save(string.Format(&quot;img-{0}.png&quot;, i), System.Drawing.Imaging.ImageFormat.Png);<br />
            }</p>
<p>        }<br />
[/csharp]</p>
<p>Here we are taking a file called Sample.xlsx and loop through the charts inside the file and save those as images with few lines codes. Sounds good right?</p>
<p><strong>VB.Net Code</strong><br />
[vb]<br />
Dim workbook As New Workbook()<br />
workbook.LoadFromFile(&quot;D:\\Sample.xlsx&quot;, ExcelVersion.Version2010)<br />
Dim sheet As Worksheet = workbook.Worksheets(0)<br />
Dim imgs As Image() = workbook.SaveChartAsImage(sheet)<br />
For i As Integer = 0 To imgs.Length &#8211; 1<br />
    imgs(i).Save(String.Format(&quot;img-{0}.png&quot;, i), ImageFormat.Png)<br />
Next<br />
[/vb]</p>
<p><strong>Conclusion</strong></p>
<p>I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/working-with-charts-using-spire-xls/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Save the Zoom View of Our Map</title>
		<link>https://mail.sibeeshpassion.com/how-to-save-the-zoom-view-of-our-map/</link>
					<comments>https://mail.sibeeshpassion.com/how-to-save-the-zoom-view-of-our-map/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 29 Apr 2015 20:47:44 +0000</pubDate>
				<category><![CDATA[High Map]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[HighChart]]></category>
		<category><![CDATA[HighMap]]></category>
		<category><![CDATA[How To Save the Zoom View of Our Map]]></category>
		<category><![CDATA[Map]]></category>
		<category><![CDATA[Save Zoom View]]></category>
		<category><![CDATA[Zoomed View]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=2081</guid>

					<description><![CDATA[Today we will learn how to save the zoom level of our map in our application. By this you can retain the zoomed view that the user sets so that it would be easier for users to identify things in our application. Background A few weeks ago I got the requirement to save the zoom level of the map. If you are new to the Bubble Map, please see here: Working with Bubble Map Download Source Code Save Zoomed View Of Map Using the code I hope you have configured a Bubble Map in your application now. Now it is [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Today we will learn how to save the zoom level of our map in our application. By this you can retain the zoomed view that the user sets so that it would be easier for users to identify things in our application.</p>
<p><strong>Background</strong></p>
<p>A few weeks ago I got the requirement to save the zoom level of the map. If you are new to the Bubble Map, please see here: <a href="http://sibeeshpassion.com/working-with-bubble-map/" target="_blank">Working with Bubble Map</a></p>
<p><strong>Download Source Code </strong></p>
<li><a href="http://sibeeshpassion.com/download/mycharts.rar" target="_blank">Save Zoomed View Of Map</a></li>
<p><strong>Using the code</strong></p>
<p>I hope you have configured a Bubble Map in your application now. Now it is time to complete our new requirement. Now what we will do is to introduce a new function that retains the zoom level from the session storage and applies it to the map. You must call this function at the end of the map configuration. </p>
<p>The following is the function code.<br />
[js]<br />
var curMax = &#8221;<br />
        var curMin = &#8221;<br />
        var curMaxY = &#8221;;<br />
        var curMinY = &#8221;;<br />
        function updateZoom(chart) {<br />
            if (sessionStorage.getItem(&quot;curMaxZoomMap&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;curMaxZoomMap&quot;) != &#8216;undefined&#8217; &amp;&amp; sessionStorage.getItem(&quot;curMinZoomMap&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;curMinZoomMap&quot;) != &#8216;undefined&#8217;) {<br />
                chart.xAxis[0].setExtremes(parseInt(sessionStorage.getItem(&quot;curMinZoomMap&quot;)), parseInt(sessionStorage.getItem(&quot;curMaxZoomMap&quot;)));<br />
            }<br />
            if (sessionStorage.getItem(&quot;curMaxZoomMapY&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;curMaxZoomMapY&quot;) != &#8216;undefined&#8217; &amp;&amp; sessionStorage.getItem(&quot;curMinZoomMapY&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;curMinZoomMapY&quot;) != &#8216;undefined&#8217;) {<br />
                chart.yAxis[0].setExtremes(parseInt(sessionStorage.getItem(&quot;curMinZoomMapY&quot;)), parseInt(sessionStorage.getItem(&quot;curMaxZoomMapY&quot;)));<br />
            }<br />
        }<br />
[/js]</p>
<p>Now we have seen how to apply the zoom level to the map. Next is how to set the value to the session storage. The fact is that whenever the user does zooming in the map, it fires events in xAxis and yAxis. So we need to crate that events in both axis.</p>
<p>Let&#8217;s look at that code now.</p>
<p>[js]<br />
xAxis: {<br />
         events: {<br />
            afterSetExtremes: function (e) {<br />
                 curMax = e.max;<br />
                 curMin = e.min;<br />
                 sessionStorage.setItem(&quot;curMaxZoomMap&quot;, curMax);<br />
                 sessionStorage.setItem(&quot;curMinZoomMap&quot;, curMin);<br />
             }<br />
         }<br />
},<br />
yAxis: {<br />
          events: {<br />
              afterSetExtremes: function (e) {<br />
                      curMaxY = e.max;<br />
                      curMinY = e.min;<br />
                      sessionStorage.setItem(&quot;curMaxZoomMapY&quot;, curMaxY);<br />
                      sessionStorage.setItem(&quot;curMinZoomMapY&quot;, curMinY);<br />
               }<br />
           }<br />
}<br />
[/js]</p>
<p>Once you have included this event you can see the values in session storage in your browser whenever the user zooms the map.</p>
<div id="attachment_9131" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/04/Save-Zoomed-View-Of-Bubble-Map.png"><img decoding="async" aria-describedby="caption-attachment-9131" src="http://sibeeshpassion.com/wp-content/uploads/2015/04/Save-Zoomed-View-Of-Bubble-Map-1024x584.png" alt="Save Zoomed View Of Bubble Map" width="634" height="362" class="size-large wp-image-9131" srcset="/wp-content/uploads/2015/04/Save-Zoomed-View-Of-Bubble-Map.png 1024w, /wp-content/uploads/2015/04/Save-Zoomed-View-Of-Bubble-Map-300x171.png 300w, /wp-content/uploads/2015/04/Save-Zoomed-View-Of-Bubble-Map-768x438.png 768w, /wp-content/uploads/2015/04/Save-Zoomed-View-Of-Bubble-Map-400x228.png 400w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-9131" class="wp-caption-text">Save Zoomed View Of Bubble Map</p></div>
<p>Our next step is to include the zoomTo even in the series of our map.<br />
[js]<br />
events: {<br />
            click: function (e) {<br />
               e.point.zoomTo();<br />
            }<br />
        }<br />
[/js]</p>
<p>So your series configuration will be as follows.<br />
[js]<br />
series: [{<br />
             mapData: map,<br />
             borderColor: &#8216;#E0E0E0&#8217;,<br />
             colour: &#8216;#E0E0E0&#8217;,<br />
             showInLegend: false,<br />
             enableMouseTracking: true,<br />
             cursor: &#8216;pointer&#8217;,<br />
             dataLabels: {<br />
                enabled: true,<br />
                format: &#8216;{point.properties.postal-code}&#8217;,<br />
                textDecoration: &#8216;none&#8217;,<br />
                style: { &quot;color&quot;: &quot;darkgrey&quot;, &quot;fontWeight&quot;: &quot;bold&quot;, &quot;HcTextStroke&quot;: &quot;0px rgba(0,0,0,0.5)&quot; }<br />
         },<br />
         events: {<br />
            click: function (e) {<br />
               e.point.zoomTo();<br />
            }<br />
        },<br />
}<br />
[/js]</p>
<p>That is all guys, you can retain the zoom level of your map even if you reload. Cool!</p>
<p><strong>Complete Code</strong><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Bubble Map Demo &#8211; sibeeshpassion&lt;/title&gt;<br />
    &lt;script src=&quot;Scripts/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/highmaps.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/proj4.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/us-all.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/world.js&quot;&gt;&lt;/script&gt;  </p>
<p>    &lt;script&gt;<br />
        var curMax = &#8221;<br />
        var curMin = &#8221;<br />
        var curMaxY = &#8221;;<br />
        var curMinY = &#8221;;<br />
        function updateZoom(chart) {<br />
            if (sessionStorage.getItem(&quot;curMaxZoomMap&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;curMaxZoomMap&quot;) != &#8216;undefined&#8217; &amp;&amp; sessionStorage.getItem(&quot;curMinZoomMap&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;curMinZoomMap&quot;) != &#8216;undefined&#8217;) {<br />
                chart.xAxis[0].setExtremes(parseInt(sessionStorage.getItem(&quot;curMinZoomMap&quot;)), parseInt(sessionStorage.getItem(&quot;curMaxZoomMap&quot;)));<br />
            }<br />
            if (sessionStorage.getItem(&quot;curMaxZoomMapY&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;curMaxZoomMapY&quot;) != &#8216;undefined&#8217; &amp;&amp; sessionStorage.getItem(&quot;curMinZoomMapY&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;curMinZoomMapY&quot;) != &#8216;undefined&#8217;) {<br />
                chart.yAxis[0].setExtremes(parseInt(sessionStorage.getItem(&quot;curMinZoomMapY&quot;)), parseInt(sessionStorage.getItem(&quot;curMaxZoomMapY&quot;)));<br />
            }<br />
        }<br />
        $(function () {<br />
            loadMap();<br />
            $(&#8216;#apply&#8217;).click(function () {<br />
                loadMap();<br />
            });<br />
        });<br />
        function loadMap() {<br />
            var selectMap = $.trim($(&quot;#mapSelectMap&quot;).val());<br />
            var zPoint = &quot;Quantity&quot;;<br />
            var jsdata = [{ &quot;State&quot;: &quot;Arizona&quot;, &quot;lat&quot;: &quot;32.8796&quot;, &quot;lon&quot;: &quot;-111.7282&quot;, &quot;Quantity&quot;: &quot;29,248&quot; }, { &quot;State&quot;: &quot;Arizona&quot;, &quot;lat&quot;: &quot;33.3197&quot;, &quot;lon&quot;: &quot;-111.9837&quot;, &quot;Quantity&quot;: &quot;102,928&quot; }, { &quot;State&quot;: &quot;Arizona&quot;, &quot;lat&quot;: &quot;33.3939&quot;, &quot;lon&quot;: &quot;-111.6965&quot;, &quot;Quantity&quot;: &quot;108,863&quot; }, { &quot;State&quot;: &quot;Arizona&quot;, &quot;lat&quot;: &quot;33.4495&quot;, &quot;lon&quot;: &quot;-112.3410&quot;, &quot;Quantity&quot;: &quot;67,218&quot; }, { &quot;State&quot;: &quot;Arizona&quot;, &quot;lat&quot;: &quot;33.6155&quot;, &quot;lon&quot;: &quot;-111.9263&quot;, &quot;Quantity&quot;: &quot;66,556&quot; }, { &quot;State&quot;: &quot;Arizona&quot;, &quot;lat&quot;: &quot;33.6384&quot;, &quot;lon&quot;: &quot;-112.2073&quot;, &quot;Quantity&quot;: &quot;147,552&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;33.6145&quot;, &quot;lon&quot;: &quot;-117.7101&quot;, &quot;Quantity&quot;: &quot;26,053&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;33.7008&quot;, &quot;lon&quot;: &quot;-117.9362&quot;, &quot;Quantity&quot;: &quot;26,057&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;33.7963&quot;, &quot;lon&quot;: &quot;-116.3845&quot;, &quot;Quantity&quot;: &quot;497,249&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;33.8274&quot;, &quot;lon&quot;: &quot;-118.0868&quot;, &quot;Quantity&quot;: &quot;32,052&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;33.8763&quot;, &quot;lon&quot;: &quot;-117.7418&quot;, &quot;Quantity&quot;: &quot;23,521&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;33.8996&quot;, &quot;lon&quot;: &quot;-118.3669&quot;, &quot;Quantity&quot;: &quot;26,169&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;34.0302&quot;, &quot;lon&quot;: &quot;-118.3865&quot;, &quot;Quantity&quot;: &quot;21,996&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;34.0569&quot;, &quot;lon&quot;: &quot;-117.2995&quot;, &quot;Quantity&quot;: &quot;59,135&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;34.0737&quot;, &quot;lon&quot;: &quot;-117.8859&quot;, &quot;Quantity&quot;: &quot;4,757&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;34.1820&quot;, &quot;lon&quot;: &quot;-118.3140&quot;, &quot;Quantity&quot;: &quot;28,909&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;34.2257&quot;, &quot;lon&quot;: &quot;-119.1551&quot;, &quot;Quantity&quot;: &quot;22,569&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;34.2300&quot;, &quot;lon&quot;: &quot;-118.5500&quot;, &quot;Quantity&quot;: &quot;22,413&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;34.4130&quot;, &quot;lon&quot;: &quot;-118.5036&quot;, &quot;Quantity&quot;: &quot;18,399&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;34.4813&quot;, &quot;lon&quot;: &quot;-117.3389&quot;, &quot;Quantity&quot;: &quot;23,268&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;34.6029&quot;, &quot;lon&quot;: &quot;-118.1464&quot;, &quot;Quantity&quot;: &quot;24,651&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;37.5038&quot;, &quot;lon&quot;: &quot;-121.9762&quot;, &quot;Quantity&quot;: &quot;4&quot; }, { &quot;State&quot;: &quot;California&quot;, &quot;lat&quot;: &quot;38.3525&quot;, &quot;lon&quot;: &quot;-122.7148&quot;, &quot;Quantity&quot;: &quot;2&quot; }, { &quot;State&quot;: &quot;Colorado&quot;, &quot;lat&quot;: &quot;38.4766&quot;, &quot;lon&quot;: &quot;-107.8812&quot;, &quot;Quantity&quot;: &quot;3,294&quot; }, { &quot;State&quot;: &quot;Colorado&quot;, &quot;lat&quot;: &quot;39.0730&quot;, &quot;lon&quot;: &quot;-108.5710&quot;, &quot;Quantity&quot;: &quot;8,704&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;27.8400&quot;, &quot;lon&quot;: &quot;-82.6800&quot;, &quot;Quantity&quot;: &quot;75,066&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;27.9400&quot;, &quot;lon&quot;: &quot;-82.3200&quot;, &quot;Quantity&quot;: &quot;135,365&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;27.9600&quot;, &quot;lon&quot;: &quot;-82.3200&quot;, &quot;Quantity&quot;: &quot;-6&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;27.9925&quot;, &quot;lon&quot;: &quot;-82.7296&quot;, &quot;Quantity&quot;: &quot;27,274&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;28.0661&quot;, &quot;lon&quot;: &quot;-82.5688&quot;, &quot;Quantity&quot;: &quot;261&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;28.0790&quot;, &quot;lon&quot;: &quot;-80.6984&quot;, &quot;Quantity&quot;: &quot;15,720&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;28.0941&quot;, &quot;lon&quot;: &quot;-81.9738&quot;, &quot;Quantity&quot;: &quot;85,437&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;28.1918&quot;, &quot;lon&quot;: &quot;-82.3812&quot;, &quot;Quantity&quot;: &quot;97,233&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;28.3027&quot;, &quot;lon&quot;: &quot;-81.4216&quot;, &quot;Quantity&quot;: &quot;135,193&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;28.5622&quot;, &quot;lon&quot;: &quot;-81.2074&quot;, &quot;Quantity&quot;: &quot;120,424&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;28.6629&quot;, &quot;lon&quot;: &quot;-81.4176&quot;, &quot;Quantity&quot;: &quot;110,185&quot; }, { &quot;State&quot;: &quot;Florida&quot;, &quot;lat&quot;: &quot;29.1800&quot;, &quot;lon&quot;: &quot;-81.0800&quot;, &quot;Quantity&quot;: &quot;66,725&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;32.8100&quot;, &quot;lon&quot;: &quot;-83.7100&quot;, &quot;Quantity&quot;: &quot;3&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;33.3671&quot;, &quot;lon&quot;: &quot;-84.7647&quot;, &quot;Quantity&quot;: &quot;87,508&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;33.4600&quot;, &quot;lon&quot;: &quot;-84.2100&quot;, &quot;Quantity&quot;: &quot;155,811&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;33.4759&quot;, &quot;lon&quot;: &quot;-82.0709&quot;, &quot;Quantity&quot;: &quot;10,875&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;33.5600&quot;, &quot;lon&quot;: &quot;-84.5400&quot;, &quot;Quantity&quot;: &quot;17,937&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;33.5610&quot;, &quot;lon&quot;: &quot;-84.3223&quot;, &quot;Quantity&quot;: &quot;203,297&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;33.6810&quot;, &quot;lon&quot;: &quot;-84.1604&quot;, &quot;Quantity&quot;: &quot;134,700&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;33.8200&quot;, &quot;lon&quot;: &quot;-84.3600&quot;, &quot;Quantity&quot;: &quot;122,120&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;33.9168&quot;, &quot;lon&quot;: &quot;-83.4439&quot;, &quot;Quantity&quot;: &quot;84,648&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;33.9522&quot;, &quot;lon&quot;: &quot;-84.1343&quot;, &quot;Quantity&quot;: &quot;105,862&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;34.0051&quot;, &quot;lon&quot;: &quot;-84.5752&quot;, &quot;Quantity&quot;: &quot;-14&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;34.0076&quot;, &quot;lon&quot;: &quot;-84.5769&quot;, &quot;Quantity&quot;: &quot;204,888&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;34.0600&quot;, &quot;lon&quot;: &quot;-83.9800&quot;, &quot;Quantity&quot;: &quot;104,291&quot; }, { &quot;State&quot;: &quot;Georgia&quot;, &quot;lat&quot;: &quot;34.1900&quot;, &quot;lon&quot;: &quot;-84.1200&quot;, &quot;Quantity&quot;: &quot;186,459&quot; }, { &quot;State&quot;: &quot;Idaho&quot;, &quot;lat&quot;: &quot;42.9101&quot;, &quot;lon&quot;: &quot;-112.4605&quot;, &quot;Quantity&quot;: &quot;5,524&quot; }, { &quot;State&quot;: &quot;Idaho&quot;, &quot;lat&quot;: &quot;43.6048&quot;, &quot;lon&quot;: &quot;-116.3496&quot;, &quot;Quantity&quot;: &quot;14,476&quot; }, { &quot;State&quot;: &quot;Illinois&quot;, &quot;lat&quot;: &quot;41.5300&quot;, &quot;lon&quot;: &quot;-87.8500&quot;, &quot;Quantity&quot;: &quot;54,989&quot; }, { &quot;State&quot;: &quot;Illinois&quot;, &quot;lat&quot;: &quot;41.7200&quot;, &quot;lon&quot;: &quot;-88.0300&quot;, &quot;Quantity&quot;: &quot;72,366&quot; }, { &quot;State&quot;: &quot;Illinois&quot;, &quot;lat&quot;: &quot;42.0500&quot;, &quot;lon&quot;: &quot;-87.8300&quot;, &quot;Quantity&quot;: &quot;59,164&quot; }, { &quot;State&quot;: &quot;Illinois&quot;, &quot;lat&quot;: &quot;42.1000&quot;, &quot;lon&quot;: &quot;-87.9700&quot;, &quot;Quantity&quot;: &quot;49,074&quot; }, { &quot;State&quot;: &quot;Illinois&quot;, &quot;lat&quot;: &quot;42.1300&quot;, &quot;lon&quot;: &quot;-88.3300&quot;, &quot;Quantity&quot;: &quot;77,454&quot; }, { &quot;State&quot;: &quot;Illinois&quot;, &quot;lat&quot;: &quot;42.2300&quot;, &quot;lon&quot;: &quot;-87.9300&quot;, &quot;Quantity&quot;: &quot;51,251&quot; }, { &quot;State&quot;: &quot;Illinois&quot;, &quot;lat&quot;: &quot;42.2600&quot;, &quot;lon&quot;: &quot;-88.9700&quot;, &quot;Quantity&quot;: &quot;57,571&quot; }, { &quot;State&quot;: &quot;Indiana&quot;, &quot;lat&quot;: &quot;39.6292&quot;, &quot;lon&quot;: &quot;-86.1252&quot;, &quot;Quantity&quot;: &quot;24,227&quot; }, { &quot;State&quot;: &quot;Indiana&quot;, &quot;lat&quot;: &quot;39.6303&quot;, &quot;lon&quot;: &quot;-86.1249&quot;, &quot;Quantity&quot;: &quot;1,074&quot; }, { &quot;State&quot;: &quot;Indiana&quot;, &quot;lat&quot;: &quot;39.7613&quot;, &quot;lon&quot;: &quot;-86.3488&quot;, &quot;Quantity&quot;: &quot;12,319&quot; }, { &quot;State&quot;: &quot;Indiana&quot;, &quot;lat&quot;: &quot;39.7634&quot;, &quot;lon&quot;: &quot;-86.3489&quot;, &quot;Quantity&quot;: &quot;1,027&quot; }, { &quot;State&quot;: &quot;Indiana&quot;, &quot;lat&quot;: &quot;40.0028&quot;, &quot;lon&quot;: &quot;-86.1227&quot;, &quot;Quantity&quot;: &quot;901&quot; }, { &quot;State&quot;: &quot;Indiana&quot;, &quot;lat&quot;: &quot;41.4900&quot;, &quot;lon&quot;: &quot;-87.4700&quot;, &quot;Quantity&quot;: &quot;83,677&quot; }, { &quot;State&quot;: &quot;Kentucky&quot;, &quot;lat&quot;: &quot;38.1438&quot;, &quot;lon&quot;: &quot;-85.6751&quot;, &quot;Quantity&quot;: &quot;-85&quot; }];<br />
            var data1 = [];<br />
            var tmp = &#8221;;<br />
            var formatedVal = 0;<br />
            if (selectMap == &quot;0&quot;) {<br />
                var H = Highcharts,<br />
                             map = H.maps[&#8216;countries/us/us-all&#8217;],<br />
                                chart;<br />
            }<br />
            else {<br />
                var H = Highcharts,<br />
                                  map = H.maps[selectMap],<br />
                                     chart;<br />
            }<br />
            $.each(jsdata, function (ix, entry) {<br />
                if (Object.keys(entry).length &gt;= 4) {<br />
                    tmp = entry[zPoint].replace(/\,/g, &#8221;).replace(/\$/g, &#8221;).replace(/\%/g, &#8221;).replace(/\(/g, &#8221;).replace(/\)/g, &#8221;);<br />
                    if (isNaN(tmp)) {<br />
                        entry.z = entry[zPoint];<br />
                    }<br />
                    else {  </p>
<p>                    }<br />
                    data1.push(entry);<br />
                }<br />
            });<br />
            chart = $(&#8216;#container&#8217;).highcharts(&#8216;Map&#8217;, {<br />
                chart: {<br />
                    borderWidth: 1<br />
                },<br />
                title: {<br />
                    text: &#8216;Bubble map&#8217;<br />
                },<br />
                subtitle: {<br />
                    text: &#8216;Bubble map sub title&#8217;<br />
                },  </p>
<p>                tooltip: {<br />
                    pointFormat: &#8216;{point.State}: {point.Quantity}&#8217;<br />
                },  </p>
<p>                mapNavigation: {<br />
                    enabled: true,<br />
                    buttonOptions: {<br />
                        verticalAlign: &#8216;bottom&#8217;<br />
                    }<br />
                },<br />
                xAxis: {<br />
                    events: {<br />
                        afterSetExtremes: function (e) {<br />
                            curMax = e.max;<br />
                            curMin = e.min;<br />
                            sessionStorage.setItem(&quot;curMaxZoomMap&quot;, curMax);<br />
                            sessionStorage.setItem(&quot;curMinZoomMap&quot;, curMin);<br />
                        }<br />
                    }<br />
                },<br />
                yAxis: {<br />
                    events: {<br />
                        afterSetExtremes: function (e) {<br />
                            curMaxY = e.max;<br />
                            curMinY = e.min;<br />
                            sessionStorage.setItem(&quot;curMaxZoomMapY&quot;, curMaxY);<br />
                            sessionStorage.setItem(&quot;curMinZoomMapY&quot;, curMinY);<br />
                        }<br />
                    }<br />
                },<br />
                legend: {<br />
                    enabled: true,<br />
                    title: {<br />
                        style: {<br />
                            color: (Highcharts.theme &amp;&amp; Highcharts.theme.textColor) || &#8216;black&#8217;<br />
                        }<br />
                    },<br />
                    layout: &#8216;vertical&#8217;,<br />
                    align: &#8216;right&#8217;,<br />
                    verticalAlign: &#8216;bottom&#8217;,<br />
                    floating: true,<br />
                    valueDecimals: 0,<br />
                    valueSuffix: &#8216;$&#8217;,<br />
                    backgroundColor: (Highcharts.theme &amp;&amp; Highcharts.theme.legendBackgroundColor) || &#8216;rgba(255, 255, 255, 0.85)&#8217;,<br />
                    symbolRadius: 0,<br />
                    symbolHeight: 14<br />
                },<br />
                series: [{<br />
                    mapData: map,<br />
                    borderColor: &#8216;#E0E0E0&#8217;,<br />
                    colour: &#8216;#E0E0E0&#8217;,<br />
                    showInLegend: false,<br />
                    enableMouseTracking: true,<br />
                    cursor: &#8216;pointer&#8217;,<br />
                    dataLabels: {<br />
                        enabled: true,<br />
                        format: &#8216;{point.properties.postal-code}&#8217;,<br />
                        textDecoration: &#8216;none&#8217;,<br />
                        style: { &quot;color&quot;: &quot;darkgrey&quot;, &quot;fontWeight&quot;: &quot;bold&quot;, &quot;HcTextStroke&quot;: &quot;0px rgba(0,0,0,0.5)&quot; }<br />
                    },<br />
                    events: {<br />
                        click: function (e) {<br />
                            e.point.zoomTo();<br />
                        }<br />
                    },<br />
                },<br />
                {<br />
                    type: &#8216;mapbubble&#8217;,<br />
                    color: &#8216;#E0E0E0&#8217;,<br />
                    dataLabels: {<br />
                        enabled: true,<br />
                        formatter: function () {<br />
                        }<br />
                    },<br />
                    enableMouseTracking: true,<br />
                    joinBy: [&#8216;iso-a2&#8217;, &#8216;code&#8217;],<br />
                    name: zPoint,<br />
                    data: data1,<br />
                    minSize: $(&quot;#mapMinBubSize&quot;).val(),<br />
                    maxSize: $(&quot;#mapMaxBubSize&quot;).val(),<br />
                    color: $(&quot;#mapColor&quot;).val(),<br />
                    displayNegative: true,<br />
                    sizeBy: &#8216;width&#8217;,<br />
                    cursor: &#8216;pointer&#8217;,<br />
                    negativeColor: Highcharts.getOptions().colors[0]<br />
                }<br />
                ],<br />
                chart: {<br />
                    marginRight: 50<br />
                },<br />
                exporting: {<br />
                    enabled: false<br />
                }<br />
            }, function (chart) {<br />
                updateZoom(chart);<br />
            });<br />
        }  </p>
<p>    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Bubble Map Demo &#8211; sibeeshpassion<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;div id=&quot;container&quot; style=&quot;min-width: 310px; height: 400px; margin: 0 auto&quot;&gt;&lt;/div&gt;<br />
    &lt;label&gt;Min Bubble Size&lt;/label&gt;<br />
    &lt;input type=&quot;number&quot; value=&quot;8&quot; min=&quot;1&quot; id=&quot;mapMinBubSize&quot; title=&quot;Type Bubble Min Size.&quot; /&gt;<br />
    &lt;label&gt;Max Bubble Size&lt;/label&gt;<br />
    &lt;input type=&quot;number&quot; min=&quot;1&quot; value=&quot;40&quot; id=&quot;mapMaxBubSize&quot; title=&quot;Type Bubble Max Size.&quot; /&gt;<br />
    &lt;label&gt;Color&lt;/label&gt;<br />
    &lt;input type=&quot;color&quot; value=&quot;#BAD6F2&quot; id=&quot;mapColor&quot; title=&quot;Select Bubble Color.&quot; /&gt;<br />
    &lt;label&gt;Select Map&lt;/label&gt;<br />
    &lt;select name=&quot;tech&quot; id=&quot;mapSelectMap&quot; class=&quot;tech&quot; title=&quot;Select Map.&quot;&gt;<br />
        &lt;option value=&quot;0&quot;&gt;Select Map&lt;/option&gt;<br />
        &lt;option value=&quot;countries/us/us-all&quot; selected=&quot;selected&quot;&gt;US alone&lt;/option&gt;<br />
        &lt;option value=&quot;custom/world&quot;&gt;Custom World&lt;/option&gt;<br />
    &lt;/select&gt;<br />
    &lt;div id=&quot;apply&quot; style=&quot;cursor: pointer; background-color: red; color: white; width: 100px; padding: 5px; float: right;&quot;&gt;Apply Settings&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Conclusion</strong></p>
<p>Please download the source code for more details. I hope you liked this article. Now please share your thoughts and suggestions. It matters a lot.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/how-to-save-the-zoom-view-of-our-map/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Drag and Drop the Legend and Maintain the Position in Chart</title>
		<link>https://mail.sibeeshpassion.com/drag-and-drop-the-legend-and-maintain-the-position-in-chart/</link>
					<comments>https://mail.sibeeshpassion.com/drag-and-drop-the-legend-and-maintain-the-position-in-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 29 Apr 2015 20:40:08 +0000</pubDate>
				<category><![CDATA[HighChart]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[Drag and drop legend in chart.]]></category>
		<category><![CDATA[Drag legend]]></category>
		<category><![CDATA[Draggable Legend]]></category>
		<category><![CDATA[Drop legend]]></category>
		<category><![CDATA[HighChart Legend]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Legend]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1961</guid>

					<description><![CDATA[Today we will learn how to create a drag-able legend and maintain that position in the chart area, so that once we drag and drop the legend, even if we reload the chart again, it will take the legend position from the session storage, where we have set the values when dropping the legend. Cool, right? Background For the past few weeks I have been working in Charts, so a few days ago I got a requirement to make a drag-able legend and maintain the position. As you all know, everyone expects the best from their products, so I began [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Today we will learn how to create a drag-able legend and maintain that position in the chart area, so that once we drag and drop the legend, even if we reload the chart again, it will take the legend position from the session storage, where we have set the values when dropping the legend. Cool, right?</p>
<p><strong>Background</strong></p>
<p>For the past few weeks I have been working in Charts, so a few days ago I got a requirement to make a drag-able legend and maintain the position. As you all know, everyone expects the best from their products, so I began working to satisfy my client by giving them all the feasible options in the chart. Once I was done with that it was good.</p>
<p><strong>Download Source Code</strong></p>
<p><a href="http://sibeeshpassion.com/download/DragAndDropLegend.rar" target="_blank">Drag and Drop the Legend and Maintain the Position</a></p>
<p><strong>Load the required files</strong></p>
<p>To start, we must load some files, you can determine the files below.<br />
[js]<br />
   &lt;script src=&quot;Scripts/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
   &lt;script src=&quot;Scripts/highcharts.js&quot;&gt;&lt;/script&gt;<br />
   &lt;script src=&quot;Scripts/highcharts-more.js&quot;&gt;&lt;/script&gt;<br />
   &lt;script src=&quot;Scripts/draggable-legend.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p><strong>Creating UI elements</strong></p>
<p>Now we need some UI elements to load the chart and show the drag and drop position. We will show the position values while the user drags and drops the legend, so that it looks more active.<br />
[html]<br />
    &lt;div id=&quot;container&quot; style=&quot;min-width: 310px; height: 400px; margin: 0 auto&quot;&gt;&lt;/div&gt;<br />
    Legend X: &lt;input id=&quot;txtLegendX&quot; type=&quot;number&quot; /&gt; &lt;br /&gt;<br />
    Legend X: &lt;input id=&quot;txtLegendY&quot; type=&quot;number&quot; /&gt;<br />
[/html]</p>
<p><strong>Creating options of chart</strong></p>
<p>The next step we need is to set the options of the chart. Please find the following settings.<br />
[js]<br />
var options = {<br />
                title: {<br />
                    text: &#8216;Worked hours in a week&#8217;<br />
                },<br />
                xAxis: {<br />
                    categories: [&#8216;Developing&#8217;, &#8216;Maitenance&#8217;, &#8216;Marketing&#8217;, &#8216;Business&#8217;, &#8216;Admin&#8217;]<br />
                },<br />
                series: [{<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Monday&#8217;,<br />
                    data: [3, 2, 1, 3, 4]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Tuesday&#8217;,<br />
                    data: [2, 3, 5, 7, 6]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Wednesday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Thursday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Friday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;spline&#8217;,<br />
                    name: &#8216;Thursday&#8217;,<br />
                    data: [3, 2.67, 3, 6.33, 3.33],<br />
                    marker: {<br />
                        lineWidth: 2,<br />
                        lineColor: Highcharts.getOptions().colors[3],<br />
                        fillColor: &#8216;white&#8217;<br />
                    }<br />
                }],<br />
                legend: {<br />
                    enabled: true,<br />
                    layout: &#8216;vertical&#8217;,<br />
                    backgroundColor: &#8216;white&#8217;,<br />
                    align: &#8216;left&#8217;,<br />
                    verticalAlign: &#8216;top&#8217;,<br />
                    y: 50,<br />
                    x: 50,<br />
                    borderWidth: 1,<br />
                    borderRadius: 0,<br />
                    title: {<br />
                        text: &#8216;::Drag Me&#8217;<br />
                    },<br />
                    floating: true,<br />
                    draggable: true,<br />
                    zIndex: 20<br />
                }<br />
            };<br />
[/js]</p>
<p>In the preceding code block we have set the series and other settings including the legend. Please note that we have set the draggable and floating property to true. You can customize all of these properties as you need to.<br />
[js]<br />
floating: true,<br />
draggable: true,<br />
[/js]</p>
<p>Now if you run your application, you will get output as follows.</p>
<div id="attachment_9161" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617.png"><img decoding="async" aria-describedby="caption-attachment-9161" src="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617.png" alt="Drag and Drop the Legend and Maintain the Position in Chart" width="650" height="148" class="size-full wp-image-9161" srcset="/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617.png 650w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617-300x68.png 300w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart1-e1439362346617-400x91.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9161" class="wp-caption-text">Drag and Drop the Legend and Maintain the Position in Chart</p></div>
<p>So our application is working fine, isn&#8217;t it?</p>
<p><strong>Changes in draggable-legend.js</strong></p>
<p>To continue with the process, we must make some changes in the draggable-legend.js. You can see the changes below. If you download the source code attached, you can see the changes by default.<br />
[js]<br />
addEvent(chart.container, &#8216;mousemove&#8217;, function (e) {  </p>
<p>});<br />
[/js]</p>
<p>I will include some code for our purposes in the preceding function in draggable-legend.js. At the end of the specified function I am including the following code block.<br />
[js]<br />
$(&quot;#txtLegendX&quot;).val(options.x);<br />
$(&quot;#txtLegendY&quot;).val(options.y);<br />
sessionStorage.setItem(&quot;legendx&quot;, options.x);<br />
sessionStorage.setItem(&quot;legendy&quot;, options.y);<br />
[/js]</p>
<p>The purpose of that code block is to set the value to the session storage and the UI element. Now we will run our application and see the output.</p>
<div id="attachment_9171" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227.png"><img decoding="async" aria-describedby="caption-attachment-9171" src="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227.png" alt="Drag and Drop the Legend and Maintain the Position in Chart" width="650" height="194" class="size-full wp-image-9171" srcset="/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227.png 650w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227-300x90.png 300w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart2-e1439362411227-400x119.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9171" class="wp-caption-text">Drag and Drop the Legend and Maintain the Position in Chart</p></div>
<p>Now if you drag and drop the legend somewhere else, you can see that the values specified in the text boxes has changed.</p>
<div id="attachment_9181" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3.png"><img decoding="async" aria-describedby="caption-attachment-9181" src="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3-1024x280.png" alt="Drag and Drop the Legend and Maintain the Position in Chart" width="634" height="173" class="size-large wp-image-9181" srcset="/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3.png 1024w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3-300x82.png 300w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3-768x210.png 768w, /wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart3-400x109.png 400w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-9181" class="wp-caption-text">Drag and Drop the Legend and Maintain the Position in Chart</p></div>
<p>No we will check whether the values are updated to the session storage in the browser console.</p>
<div id="attachment_9191" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart4-e1439362495549.png"><img decoding="async" aria-describedby="caption-attachment-9191" src="http://sibeeshpassion.com/wp-content/uploads/2015/04/drag-and-drop-the-legend-and-maintain-the-position-in-chart4-1024x313.png" alt="Drag and Drop the Legend and Maintain the Position in Chart" width="634" height="194" class="size-large wp-image-9191" /></a><p id="caption-attachment-9191" class="wp-caption-text">Drag and Drop the Legend and Maintain the Position in Chart</p></div>
<p>Cool, it is updated, we are happy.</p>
<p>Now we need to retain this position even if the user reloads the chart, right? Normally what happens is, the chart will be loaded with the initial settings we have set in the option. </p>
<p><strong>Maintain the legend position</strong></p>
<p>To maintain the legend position, we must apply the legend position to the chart, we can take the values from the session storage where we already set the values.<br />
[js]<br />
if (sessionStorage.getItem(&quot;legendx&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;legendx&quot;) != &#8216;undefined&#8217; &amp;&amp; sessionStorage.getItem(&quot;legendy&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;legendy&quot;) != &#8216;undefined&#8217;) {<br />
                options.legend.x = parseInt(sessionStorage.getItem(&quot;legendx&quot;));<br />
                options.legend.y = parseInt(sessionStorage.getItem(&quot;legendy&quot;));<br />
                $(&quot;#txtLegendX&quot;).val(sessionStorage.getItem(&quot;legendx&quot;));<br />
                $(&quot;#txtLegendY&quot;).val(sessionStorage.getItem(&quot;legendy&quot;));<br />
            }<br />
            $(&#8216;#container&#8217;).highcharts(options);<br />
[/js]</p>
<p>We are checking the session storage values and applying values to the options and we provide that options to the chart. Sounds good? So our complete code for this implementation is as follows.</p>
<p><strong>Complete code</strong><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Dragable Legend &#8211; sibeeshpassion&lt;/title&gt;<br />
    &lt;script src=&quot;Scripts/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/highcharts.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/highcharts-more.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;Scripts/draggable-legend.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        $(function () {<br />
            var options = {<br />
                title: {<br />
                    text: &#8216;Worked hours in a week&#8217;<br />
                },<br />
                xAxis: {<br />
                    categories: [&#8216;Developing&#8217;, &#8216;Maitenance&#8217;, &#8216;Marketing&#8217;, &#8216;Business&#8217;, &#8216;Admin&#8217;]<br />
                },<br />
                series: [{<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Monday&#8217;,<br />
                    data: [3, 2, 1, 3, 4]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Tuesday&#8217;,<br />
                    data: [2, 3, 5, 7, 6]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Wednesday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Thursday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;column&#8217;,<br />
                    name: &#8216;Friday&#8217;,<br />
                    data: [4, 3, 3, 9, 0]<br />
                }, {<br />
                    type: &#8216;spline&#8217;,<br />
                    name: &#8216;Thursday&#8217;,<br />
                    data: [3, 2.67, 3, 6.33, 3.33],<br />
                    marker: {<br />
                        lineWidth: 2,<br />
                        lineColor: Highcharts.getOptions().colors[3],<br />
                        fillColor: &#8216;white&#8217;<br />
                    }<br />
                }],<br />
                legend: {<br />
                    enabled: true,<br />
                    layout: &#8216;vertical&#8217;,<br />
                    backgroundColor: &#8216;white&#8217;,<br />
                    align: &#8216;left&#8217;,<br />
                    verticalAlign: &#8216;top&#8217;,<br />
                    y: 50,<br />
                    x: 50,<br />
                    borderWidth: 1,<br />
                    borderRadius: 0,<br />
                    title: {<br />
                        text: &#8216;::Drag Me&#8217;<br />
                    },<br />
                    floating: true,<br />
                    draggable: true,<br />
                    zIndex: 20<br />
                }<br />
            };<br />
            if (sessionStorage.getItem(&quot;legendx&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;legendx&quot;) != &#8216;undefined&#8217; &amp;&amp; sessionStorage.getItem(&quot;legendy&quot;) != null &amp;&amp; typeof sessionStorage.getItem(&quot;legendy&quot;) != &#8216;undefined&#8217;) {<br />
                options.legend.x = parseInt(sessionStorage.getItem(&quot;legendx&quot;));<br />
                options.legend.y = parseInt(sessionStorage.getItem(&quot;legendy&quot;));<br />
                $(&quot;#txtLegendX&quot;).val(sessionStorage.getItem(&quot;legendx&quot;));<br />
                $(&quot;#txtLegendY&quot;).val(sessionStorage.getItem(&quot;legendy&quot;));<br />
            }<br />
            $(&#8216;#container&#8217;).highcharts(options);  </p>
<p>        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Dragable Legend &#8211; sibeeshpassion<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;div id=&quot;container&quot; style=&quot;min-width: 310px; height: 400px; margin: 0 auto&quot;&gt;&lt;/div&gt;<br />
    Legend X: &lt;input id=&quot;txtLegendX&quot; type=&quot;number&quot; /&gt; &lt;br /&gt;<br />
    Legend X: &lt;input id=&quot;txtLegendY&quot; type=&quot;number&quot; /&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Conclusion</strong></p>
<p>I hope you liked this article. Please provide your valuable suggestions. It matters a lot. Please download the source code to determine more.</p>
<p><strong>Points of interest</strong></p>
<p>Legend, Chart, Drag legend, Drop legend, Drag and drop legend in chart.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/drag-and-drop-the-legend-and-maintain-the-position-in-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Advanced JQX Grid With All Functionality</title>
		<link>https://mail.sibeeshpassion.com/advanced-jqx-grid-with-all-functionality/</link>
					<comments>https://mail.sibeeshpassion.com/advanced-jqx-grid-with-all-functionality/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 29 Oct 2014 19:05:41 +0000</pubDate>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JQWidgets]]></category>
		<category><![CDATA[JQX Grid]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Advanced Grid]]></category>
		<category><![CDATA[Client Side Grid]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[HTML Grid]]></category>
		<category><![CDATA[JQwidget Property]]></category>
		<category><![CDATA[JSON Grid]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=431</guid>

					<description><![CDATA[In this article we will see how we can implement or create a JQWidget&#8217;s JQX grid in our application. It is a client side grid which is good in performance and speed. We will see the advanced properties of a JQWidget JQX gris in this article. This article has been selected as Asp.Net Community Article of the Day Sunday January 11 ,2015. If you are new to the term JQX Grid then please find out the articles related to JQWidget category here: http://sibeeshpassion.com/category/products/jqwidgets/ If you need to bind the data source dynamically, please read here: http://sibeeshpassion.com/Convert-CellSet-to-HTML-table-And-From-HTML-To-Json-To-Array. For the past days [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article we will see how we can implement or create a JQWidget&#8217;s JQX grid in our application. It is a client side grid which is good in performance and speed. We will see the advanced properties of a JQWidget JQX gris in this article.</p>
<p><em>This article has been selected as <a href="http://asp.net/community/articles" target="_blank">Asp.Net Community Article of the Day</a> Sunday January 11 ,2015.</em></p>
<p>If you are new to the term JQX Grid then please find out the articles related to JQWidget category here: <a href="http://sibeeshpassion.com/category/products/jqwidgets/" target="_blank">http://sibeeshpassion.com/category/products/jqwidgets/</a></p>
<p>If you need to bind the data source dynamically, please read here: <a href="http://sibeeshpassion.com/Convert-CellSet-to-HTML-table-And-From-HTML-To-Json-To-Array" target="_blank">http://sibeeshpassion.com/Convert-CellSet-to-HTML-table-And-From-HTML-To-Json-To-Array</a>. For the past days I have been working on JQX Grid. Now I will share that Grid with all the functionality.</p>
<p><strong>Download the source code</strong></p>
<li><a href="https://code.msdn.microsoft.com/Advanced-JQX-Grid-With-All-37dccb56" target="_blank">Advanced JQXGrid </a></li>
<p><strong>Background</strong></p>
<p>In my previous article, one member asked for some functionality. So I thought of sharing that info. Please note that I have not implemented all the functionalities. I have selected some important features that we may use in our programming life.</p>
<p><strong>Using the code</strong></p>
<p>As we discussed in the previous articles, we need a web application with all the contents of JQX Widgets (<a href="http://sibeeshpassion.com/working-with-jqx-grid-with-filtering-and-sorting/" target="_blank">http://sibeeshpassion.com/working-with-jqx-grid-with-filtering-and-sorting/</a> ).</p>
<p><strong>What is JQX Grid?</strong></p>
<p>jqxGrid is powerful datagrid widget built entirely with open web standards. It offers rich functionality, easy to use APIs and works across devices and browsers. jqxGrid delivers advanced data visualization features and built-in support for client and server-side paging, editing, sorting and filtering.</p>
<p><strong>What we need?</strong></p>
<p><em>Simple HTML</em><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=“en”&gt;<br />
   &lt;head&gt;<br />
       &lt;title&gt;&lt;/title&gt;<br />
   &lt;/head&gt;<br />
   &lt;body&gt;<br />
   &lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Include the extra UI elements</strong><br />
[html]<br />
&lt;body class=‘default’&gt;<br />
    &lt;div id=‘jqxWidget’ style=“font-size: 13px; font-family: Verdana; float: left;”&gt;<br />
        &lt;div id=“jqxgrid”&gt;&lt;/div&gt;<br />
        &lt;div style=‘margin-top: 20px;’&gt;<br />
            &lt;div style=‘float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to Excel” id=‘excelExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to XML” id=‘xmlExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to CSV” id=‘csvExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to TSV” id=‘tsvExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to HTML” id=‘htmlExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to JSON” id=‘jsonExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Print” id=‘print’ /&gt;<br />
            &lt;/div&gt;<br />
        &lt;/div&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
[/html]</p>
<p><strong>Include Reference</strong></p>
<p>[html]<br />
&lt;link rel=“stylesheet” href=“jqwidgets/styles/jqx.base.css” type=“text/css” /&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/jquery-1.11.1.min.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcore.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdata.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxbuttons.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxscrollbar.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxlistbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdropdownlist.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxmenu.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.filter.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.sort.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.selection.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxpanel.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcheckbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/demos.js”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.pager.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.edit.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.columnsresize.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.columnsreorder.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxdata.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/html]</p>
<p><strong>What we add new?</strong><br />
[js]<br />
&lt;script src=“jqwidgets/jqxgrid.pager.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>This script is for adding the functionality of Paging :). You can add the functionality to the grid as<br />
[js]<br />
pageable: true.<br />
[/js]</p>
<p>And if you want different stylish paging then you can set that like this:<br />
[js]<br />
pagermode: ‘simple’,<br />
[/js]<br />
[js]<br />
&lt;script src=“jqwidgets/jqxgrid.edit.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>This script is for adding the functionality of Editing :). You can add the functionality to the grid as<br />
[js]<br />
editable: true.<br />
[/js]<br />
[js]<br />
&lt;script src=“jqwidgets/jqxgrid.columnsresize.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
&lt;script src=“jqwidgets/jqxgrid.columnsreorder.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>These scripts are for adding the functionality of Hierarchy columns. If we want to separate the data in the column header then you can include the following scripts.<br />
[js]<br />
&lt;script src=“jqwidgets/jqxgrid.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
&lt;script src=“jqwidgets/jqxdata.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>When you want to export your grid to any formate, please include those scripts. You can implement the same just like the following:<br />
[js]<br />
$(“#excelExport”).jqxButton({ theme: theme }); //Assign styles to the button<br />
            $(“#xmlExport”).jqxButton({ theme: theme });<br />
            $(“#csvExport”).jqxButton({ theme: theme });<br />
            $(“#tsvExport”).jqxButton({ theme: theme });<br />
            $(“#htmlExport”).jqxButton({ theme: theme });<br />
            $(“#jsonExport”).jqxButton({ theme: theme });<br />
            $(“#excelExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xls’, ‘jqxGrid’); // To export to xlx<br />
            });<br />
            $(“#xmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xml’, ‘jqxGrid’); //To export to XML<br />
            });<br />
            $(“#csvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘csv’, ‘jqxGrid’); // To export to csv<br />
            });<br />
            $(“#tsvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘tsv’, ‘jqxGrid’); // To export to tsv<br />
            });<br />
            $(“#htmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’, ‘jqxGrid’); // To export to html<br />
            });<br />
            $(“#jsonExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘json’, ‘jqxGrid’); // To export to JSON<br />
            });<br />
[/js]</p>
<p>If you want to print your grid:<br />
[js]<br />
$(“#print”).jqxButton();<br />
            $(“#print”).click(function () {<br />
                var gridContent = $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’);<br />
                var newWindow = window.open(”, ”, ‘width=800, height=500′),<br />
                document = newWindow.document.open(),<br />
                pageContent =<br />
                    ‘&lt;!DOCTYPE html&gt;\n’ +<br />
                    ‘&lt;html&gt;\n’ +<br />
                    ‘&lt;head&gt;\n’ +<br />
                    ‘&lt;meta charset=”utf-8″ /&gt;\n’ +<br />
                    ‘&lt;title&gt;jQWidgets Grid&lt;/title&gt;\n’ +<br />
                    ‘&lt;/head&gt;\n’ +<br />
                    ‘&lt;body&gt;\n’ + gridContent + ‘\n&lt;/body&gt;\n&lt;/html&gt;’;<br />
                document.write(pageContent);<br />
                document.close();<br />
                newWindow.print();<br />
            });<br />
[/js]</p>
<p>Now we need data to populate the grid, right? Since we are familiar with a simple header JQX Grid from the previous article, now we can go for a hierarchy column grid. So let’s say we have XML as follows:</p>
<p>[xml]<br />
&lt;DATA&gt;<br />
    &lt;ROW&gt;<br />
        &lt;ProductID&gt;72&lt;/ProductID&gt;<br />
        &lt;SupplierName&gt;Formaggi Fortini s.r.l.&lt;/SupplierName&gt;<br />
        &lt;Quantity&gt;24 – 200 g pkgs.&lt;/Quantity&gt;<br />
        &lt;Freight&gt;32.3800&lt;/Freight&gt;<br />
        &lt;OrderDate&gt;1996-07-04 00:00:00&lt;/OrderDate&gt;<br />
        &lt;OrderAddress&gt;59 rue de l-Abbaye&lt;/OrderAddress&gt;<br />
        &lt;Price&gt;34.8000&lt;/Price&gt;<br />
        &lt;City&gt;Ravenna&lt;/City&gt;<br />
        &lt;Address&gt;Viale Dante, 75&lt;/Address&gt;<br />
        &lt;ProductName&gt;Mozzarella di Giovanni&lt;/ProductName&gt;<br />
    &lt;/ROW&gt;<br />
    &lt;ROW&gt;<br />
        &lt;ProductID&gt;42&lt;/ProductID&gt;<br />
        &lt;SupplierName&gt;Leka Trading&lt;/SupplierName&gt;<br />
        &lt;Quantity&gt;32 – 1 kg pkgs.&lt;/Quantity&gt;<br />
        &lt;Freight&gt;32.3800&lt;/Freight&gt;<br />
        &lt;OrderDate&gt;1996-07-04 00:00:00&lt;/OrderDate&gt;<br />
        &lt;OrderAddress&gt;59 rue de l-Abbaye&lt;/OrderAddress&gt;<br />
        &lt;Price&gt;14.0000&lt;/Price&gt;<br />
        &lt;City&gt;Singapore&lt;/City&gt;<br />
        &lt;Address&gt;471 Serangoon Loop, Suite #402&lt;/Address&gt;<br />
        &lt;ProductName&gt;Singaporean Hokkien Fried Mee&lt;/ProductName&gt;<br />
    &lt;/ROW&gt;<br />
    &lt;ROW&gt;<br />
        ……..<br />
    &lt;/ROW&gt;<br />
    &lt;ROW&gt;<br />
       ……..<br />
    &lt;/ROW&gt;<br />
&lt;/DATA&gt;<br />
[/xml]</p>
<p>Please find the <em>orderdetailsextended.xml</em> from the source.</p>
<p><strong>Implementing a JQX GRid with advanced features</strong><br />
[js]<br />
&lt;script type=“text/javascript”&gt;<br />
         $(document).ready(function () {<br />
             // prepare the data<br />
             var source =<br />
            {<br />
                datatype: “xml”,<br />
                datafields: [<br />
                     { name: ‘SupplierName’, type: ‘string’ },<br />
                     { name: ‘Quantity’, type: ‘number’ },<br />
                     { name: ‘OrderDate’, type: ‘date’ },<br />
                     { name: ‘OrderAddress’, type: ‘string’ },<br />
                     { name: ‘Freight’, type: ‘number’ },<br />
                     { name: ‘Price’, type: ‘number’ },<br />
                     { name: ‘City’, type: ‘string’ },<br />
                     { name: ‘ProductName’, type: ‘string’ },<br />
                     { name: ‘Address’, type: ‘string’ }<br />
                ],<br />
                url: ‘orderdetailsextended.xml’,<br />
                root: ‘DATA’,<br />
                record: ‘ROW’<br />
            };<br />
             var dataAdapter = new $.jqx.dataAdapter(source, {<br />
                 loadComplete: function () {<br />
                 }<br />
             });<br />
             // create jqxgrid.<br />
             $(“#jqxgrid”).jqxGrid(<br />
            {<br />
                width: 900,<br />
                source: dataAdapter,<br />
                filterable: true,<br />
                sortable: true,<br />
                pageable: true,<br />
                autorowheight: true,<br />
                altrows: true,<br />
                columnsresize: true,<br />
                columns: [<br />
                  { text: ‘Supplier Name’, cellsalign: ‘center’, align: ‘center’, datafield: ‘SupplierName’, width: 110 },<br />
                  { text: ‘Name’, columngroup: ‘ProductDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘ProductName’, width: 120 },<br />
                  { text: ‘Quantity’, columngroup: ‘ProductDetails’, datafield: ‘Quantity’, cellsformat: ‘d’, cellsalign: ‘center’, align: ‘center’, width: 80 },<br />
                  { text: ‘Freight’, columngroup: ‘OrderDetails’, datafield: ‘Freight’, cellsformat: ‘d’, cellsalign: ‘center’, align: ‘center’, width: 100 },<br />
                  { text: ‘Order Date’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, cellsformat: ‘d’, datafield: ‘OrderDate’, width: 100 },<br />
                  { text: ‘Order Address’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘OrderAddress’, width: 100 },<br />
                  { text: ‘Price’, columngroup: ‘ProductDetails’, datafield: ‘Price’, cellsformat: ‘c2′, align: ‘center’, cellsalign: ‘center’, width: 70 },<br />
                  { text: ‘Address’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘Address’, width: 120 },<br />
                  { text: ‘City’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘City’, width: 80 }<br />
                ],<br />
                columngroups:<br />
                [<br />
                  { text: ‘Product Details’, align: ‘center’, name: ‘ProductDetails’ },<br />
                  { text: ‘Order Details’, parentgroup: ‘ProductDetails’, align: ‘center’, name: ‘OrderDetails’ },<br />
                  { text: ‘Location’, align: ‘center’, name: ‘Location’ }<br />
                ]<br />
            });<br />
            $(“#excelExport”).jqxButton({ theme: theme });<br />
            $(“#xmlExport”).jqxButton({ theme: theme });<br />
            $(“#csvExport”).jqxButton({ theme: theme });<br />
            $(“#tsvExport”).jqxButton({ theme: theme });<br />
            $(“#htmlExport”).jqxButton({ theme: theme });<br />
            $(“#jsonExport”).jqxButton({ theme: theme });<br />
            $(“#excelExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xls’, ‘jqxGrid’);<br />
            });<br />
            $(“#xmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xml’, ‘jqxGrid’);<br />
            });<br />
            $(“#csvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘csv’, ‘jqxGrid’);<br />
            });<br />
            $(“#tsvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘tsv’, ‘jqxGrid’);<br />
            });<br />
            $(“#htmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’, ‘jqxGrid’);<br />
            });<br />
            $(“#jsonExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘json’, ‘jqxGrid’);<br />
            });<br />
            $(“#print”).jqxButton();<br />
            $(“#print”).click(function () {<br />
                var gridContent = $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’);<br />
                var newWindow = window.open(”, ”, ‘width=800, height=500′),<br />
                document = newWindow.document.open(),<br />
                pageContent =<br />
                    ‘&lt;!DOCTYPE html&gt;\n’ +<br />
                    ‘&lt;html&gt;\n’ +<br />
                    ‘&lt;head&gt;\n’ +<br />
                    ‘&lt;meta charset=”utf-8″ /&gt;\n’ +<br />
                    ‘&lt;title&gt;jQWidgets Grid&lt;/title&gt;\n’ +<br />
                    ‘&lt;/head&gt;\n’ +<br />
                    ‘&lt;body&gt;\n’ + gridContent + ‘\n&lt;/body&gt;\n&lt;/html&gt;’;<br />
                document.write(pageContent);<br />
                document.close();<br />
                newWindow.print();<br />
            });<br />
         });<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>In the preceding script you can see a code part as follows:<br />
[js]<br />
columngroups:<br />
               [<br />
                  { text: ‘Product Details’, align: ‘center’, name: ‘ProductDetails’ },<br />
                  { text: ‘Order Details’, parentgroup: ‘ProductDetails’, align: ‘center’, name: ‘OrderDetails’ },<br />
                  { text: ‘Location’, align: ‘center’, name: ‘Location’ }<br />
               ]<br />
[/js]</p>
<p>This is where the column grouping is happening. And if you want to add a column under this column you can set that as follows:<br />
[js]<br />
{ text: ‘Name’, columngroup: ‘ProductDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘ProductName’, width: 120 }<br />
[/js]</p>
<p>You can specify this as needed and your data source.Now this is how our page looks like.<br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=“en”&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;&lt;/title&gt;<br />
    &lt;link rel=“stylesheet” href=“jqwidgets/styles/jqx.base.css” type=“text/css” /&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/jquery-1.11.1.min.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcore.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdata.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxbuttons.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxscrollbar.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxlistbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdropdownlist.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxmenu.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.filter.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.sort.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.selection.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxpanel.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcheckbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/demos.js”&gt;&lt;/script&gt;<br />
    &lt;script src=“generatedata.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.pager.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.edit.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.columnsresize.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.columnsreorder.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxdata.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
     &lt;script type=“text/javascript”&gt;<br />
         $(document).ready(function () {<br />
             // prepare the data<br />
             var source =<br />
            {<br />
                datatype: “xml”,<br />
                datafields: [<br />
                     { name: ‘SupplierName’, type: ‘string’ },<br />
                     { name: ‘Quantity’, type: ‘number’ },<br />
                     { name: ‘OrderDate’, type: ‘date’ },<br />
                     { name: ‘OrderAddress’, type: ‘string’ },<br />
                     { name: ‘Freight’, type: ‘number’ },<br />
                     { name: ‘Price’, type: ‘number’ },<br />
                     { name: ‘City’, type: ‘string’ },<br />
                     { name: ‘ProductName’, type: ‘string’ },<br />
                     { name: ‘Address’, type: ‘string’ }<br />
                ],<br />
                url: ‘orderdetailsextended.xml’,<br />
                root: ‘DATA’,<br />
                record: ‘ROW’<br />
            };<br />
             var dataAdapter = new $.jqx.dataAdapter(source, {<br />
                 loadComplete: function () {<br />
                 }<br />
             });<br />
             // create jqxgrid.<br />
             $(“#jqxgrid”).jqxGrid(<br />
            {<br />
                width: 900,<br />
                source: dataAdapter,<br />
                filterable: true,<br />
                sortable: true,<br />
                pageable: true,<br />
                autorowheight: true,<br />
                altrows: true,<br />
                columnsresize: true,<br />
                columns: [<br />
                  { text: ‘Supplier Name’, cellsalign: ‘center’, align: ‘center’, datafield: ‘SupplierName’, width: 110 },<br />
                  { text: ‘Name’, columngroup: ‘ProductDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘ProductName’, width: 120 },<br />
                  { text: ‘Quantity’, columngroup: ‘ProductDetails’, datafield: ‘Quantity’, cellsformat: ‘d’, cellsalign: ‘center’, align: ‘center’, width: 80 },<br />
                  { text: ‘Freight’, columngroup: ‘OrderDetails’, datafield: ‘Freight’, cellsformat: ‘d’, cellsalign: ‘center’, align: ‘center’, width: 100 },<br />
                  { text: ‘Order Date’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, cellsformat: ‘d’, datafield: ‘OrderDate’, width: 100 },<br />
                  { text: ‘Order Address’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘OrderAddress’, width: 100 },<br />
                  { text: ‘Price’, columngroup: ‘ProductDetails’, datafield: ‘Price’, cellsformat: ‘c2′, align: ‘center’, cellsalign: ‘center’, width: 70 },<br />
                  { text: ‘Address’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘Address’, width: 120 },<br />
                  { text: ‘City’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘City’, width: 80 }<br />
                ],<br />
                columngroups:<br />
                [<br />
                  { text: ‘Product Details’, align: ‘center’, name: ‘ProductDetails’ },<br />
                  { text: ‘Order Details’, parentgroup: ‘ProductDetails’, align: ‘center’, name: ‘OrderDetails’ },<br />
                  { text: ‘Location’, align: ‘center’, name: ‘Location’ }<br />
                ]<br />
            });<br />
            $(“#excelExport”).jqxButton({ theme: theme });<br />
            $(“#xmlExport”).jqxButton({ theme: theme });<br />
            $(“#csvExport”).jqxButton({ theme: theme });<br />
            $(“#tsvExport”).jqxButton({ theme: theme });<br />
            $(“#htmlExport”).jqxButton({ theme: theme });<br />
            $(“#jsonExport”).jqxButton({ theme: theme });<br />
            $(“#excelExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xls’, ‘jqxGrid’);<br />
            });<br />
            $(“#xmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xml’, ‘jqxGrid’);<br />
            });<br />
            $(“#csvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘csv’, ‘jqxGrid’);<br />
            });<br />
            $(“#tsvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘tsv’, ‘jqxGrid’);<br />
            });<br />
            $(“#htmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’, ‘jqxGrid’);<br />
            });<br />
            $(“#jsonExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘json’, ‘jqxGrid’);<br />
            });<br />
            $(“#print”).jqxButton();<br />
            $(“#print”).click(function () {<br />
                var gridContent = $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’);<br />
                var newWindow = window.open(”, ”, ‘width=800, height=500′),<br />
                document = newWindow.document.open(),<br />
                pageContent =<br />
                    ‘&lt;!DOCTYPE html&gt;\n’ +<br />
                    ‘&lt;html&gt;\n’ +<br />
                    ‘&lt;head&gt;\n’ +<br />
                    ‘&lt;meta charset=”utf-8″ /&gt;\n’ +<br />
                    ‘&lt;title&gt;jQWidgets Grid&lt;/title&gt;\n’ +<br />
                    ‘&lt;/head&gt;\n’ +<br />
                    ‘&lt;body&gt;\n’ + gridContent + ‘\n&lt;/body&gt;\n&lt;/html&gt;’;<br />
                document.write(pageContent);<br />
                document.close();<br />
                newWindow.print();<br />
            });<br />
         });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body class=‘default’&gt;<br />
    &lt;div id=‘jqxWidget’ style=“font-size: 13px; font-family: Verdana; float: left;”&gt;<br />
        &lt;div id=“jqxgrid”&gt;&lt;/div&gt;<br />
        &lt;div style=‘margin-top: 20px;’&gt;<br />
            &lt;div style=‘float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to Excel” id=‘excelExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to XML” id=‘xmlExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to CSV” id=‘csvExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to TSV” id=‘tsvExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to HTML” id=‘htmlExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to JSON” id=‘jsonExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Print” id=‘print’ /&gt;<br />
            &lt;/div&gt;<br />
        &lt;/div&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>That is all. We have successfully created a wonderful JQX Grid as in the following:</p>
<div id="attachment_8991" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1.jpg"><img decoding="async" aria-describedby="caption-attachment-8991" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="528" class="size-full wp-image-8991" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1.jpg 439w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1-300x244.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1-400x325.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-8991" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<div id="attachment_9001" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2.jpg"><img decoding="async" aria-describedby="caption-attachment-9001" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="536" class="size-full wp-image-9001" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2.jpg 433w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2-300x247.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2-400x330.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9001" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<div id="attachment_9011" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3.jpg"><img decoding="async" aria-describedby="caption-attachment-9011" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="530" class="size-full wp-image-9011" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3.jpg 438w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3-300x245.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3-400x326.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9011" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<p>Now you may think, why are those export buttons outside? It looks different, right? Now we can work on it. In the JQX Grid there is an option called showtoolbar, by setting this to true we can have a toolbar along with the grid. There we can bind all of these buttons if you want. So shall we start?<br />
[js]<br />
showtoolbar: true,<br />
[/js]</p>
<p>Add that line to your JQX grid implementation. Next we need to append the UI elements to the tool bar, right?<br />
[js]<br />
rendertoolbar:function (toolbar) {<br />
                                     var me = this;<br />
                                     var container = $(“&lt;div &gt;&lt;/div&gt;”);<br />
                                     var input = $(‘&lt;div id=”excelExport” style=”background-color: #555555;float: left; font-<br />
                                                    weight: bold;line-height: 28px; min-<br />
                                                    width: 80px;padding: 3px 5px 3px 10px;color: #fff; “&gt;Excel&lt;/div&gt;<br />
                                                    div style=”background-color: #555555;float: left; font-weight: bold;line-<br />
                                                    height: 28px; min-width: 80px;padding: 3px 5px 3px 10px;color: #fff; margin-<br />
                                                    left: 3px;” id=”print” &gt;Print&lt;/div&gt;&lt;/div&gt;’);<br />
                                     toolbar.append(container);<br />
                                     container.append(input);<br />
                                 }<br />
[/js]</p>
<p>Add the preceding function also. 🙂 Now this is how your JQX Grid Implementation must be:<br />
[js]<br />
$(“#jqxgrid”).jqxGrid(<br />
                        {<br />
                            width: 900,<br />
                            source: dataAdapter,<br />
                            filterable: true,<br />
                            sortable: true,<br />
                            pageable: true,<br />
                            autorowheight: true,<br />
                            altrows: true,<br />
                            columnsresize: true,<br />
                            showtoolbar: true,<br />
                            rendertoolbar: function (toolbar) {<br />
                            var me = this;<br />
                            var container = $(“&lt;div &gt;&lt;/div&gt;”);<br />
                            var input = $(‘&lt;div id=”div1″ style=”background-color: #555555;float: left; font-weight: bold;line-<br />
                                          height: 28px; min-width: 80px;padding: 3px 5px 3px 10px;color: #fff; “&gt;Your First Div&lt;/div&gt;<br />
                                          &lt;div style=”background-color: #555555;float: left; font-weight: bold;line-height: 28px; min-<br />
                                          width: 80px;padding: 3px 5px 3px 10px;color: #fff; margin-<br />
                                          left: 3px;” id=”Div2″ &gt;Your Second Div&lt;/div&gt;&lt;/div&gt;’);<br />
                           toolbar.append(container);<br />
                           container.append(input);<br />
                      },<br />
                columns: [<br />
                           { text: ‘Supplier Name’, cellsalign: ‘center’, align: ‘center’, datafield: ‘SupplierName’, width: 110 },<br />
                           { text: ‘Name’, columngroup: ‘ProductDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘ProductName’<br />
                             , width: 120 },<br />
                           { text: ‘Quantity’, columngroup: ‘ProductDetails’, datafield: ‘Quantity’, cellsformat: ‘d’, cellsalign: ‘cente<br />
                             r’, align: ‘center’, width: 80 },<br />
                           { text: ‘Freight’, columngroup: ‘OrderDetails’, datafield: ‘Freight’, cellsformat: ‘d’, cellsalign: ‘center’,<br />
                             align: ‘center’, width: 100 },<br />
                           { text: ‘Order Date’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, cellsformat: ‘d’, da<br />
                             tafield: ‘OrderDate’, width: 100 },<br />
                           { text: ‘Order Address’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘Order<br />
                             Address’, width: 100 },<br />
                           { text: ‘Price’, columngroup: ‘ProductDetails’, datafield: ‘Price’, cellsformat: ‘c2′, align: ‘center’, cellsa<br />
                             lign: ‘center’, width: 70 },<br />
                           { text: ‘Address’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘Address’, width<br />
                             : 120 },<br />
                           { text: ‘City’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘City’, width: 80 }<br />
                         ],<br />
           columngroups: [<br />
                           { text: ‘Product Details’, align: ‘center’, name: ‘ProductDetails’ },<br />
                           { text: ‘Order Details’, parentgroup: ‘ProductDetails’, align: ‘center’, name: ‘OrderDetails’ },<br />
                           { text: ‘Location’, align: ‘center’, name: ‘Location’ }<br />
                         ]<br />
         });<br />
[/js]</p>
<p>Now your output looks like the following:</p>
<div id="attachment_9021" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4.jpg"><img decoding="async" aria-describedby="caption-attachment-9021" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="522" class="size-full wp-image-9021" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4.jpg 445w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4-300x241.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4-400x321.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9021" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<p>What if you want to share this Grid with your friends? For that we have a jQuery share pluggin, <a href="http://www.jqueryscript.net/social-media/Minimal-jQuery-Plugin-For-Social-Share-Buttons-Sharer.html" target="_blank">Minimal jQuery Plugin For Social Share Buttons – Sharer</a>.</p>
<p><strong>Include the following files from the downloded rar from the preceding link</strong></p>
<li>jquery.sharer.css</li>
<li>jquery.sharer.js</li>
<li>sharer.png</li>
<p>[js]<br />
&lt;link href=“styles/jquery.sharer.css” rel=“stylesheet” type=“text/css” /&gt;<br />
&lt;script src=“scripts/jquery.sharer.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p><strong>Include the script to your page</strong><br />
[js]<br />
$(“.social-buttons”).sharer();<br />
[/js]</p>
<p><strong>Add a div where you can see the share buttons</strong><br />
[js]<br />
&lt;div class=“social-buttons” style=“position: relative;z-index: 1000;”&gt;&lt;/div&gt;<br />
[/js]</p>
<p>Well, that’s all; you have now done everything. We can now see the page as,</p>
<div id="attachment_9031" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5.jpg"><img decoding="async" aria-describedby="caption-attachment-9031" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="478" class="size-full wp-image-9031" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5.jpg 485w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5-300x221.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5-400x294.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9031" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<p>To set the page size add the following line to your grid settings:<br />
[js]<br />
pagesize: 50,<br />
[/js]</p>
<p>To set the custom pagesize options add the following line to your grid settings:<br />
[js]<br />
pagesizeoptions: [‘5′,’10’,’15’,’20’,’30’,’40’,’50’],<br />
[/js]</p>
<p>To allow resizing of the columns add the following line to your grid settings:<br />
[js]<br />
columnsresize: true,<br />
[/js]</p>
<p>To allow column re-ordering options add the following line to your grid settings:</p>
<p>[js]<br />
columnsreorder: true,<br />
[/js]</p>
<p>Be sure that you added the <em>jqxgrid.columnsreorder.js</em> JavaScript file.</p>
<p>To allow an Excel-like filter add the following line to your grid settings:<br />
[js]<br />
filtermode: ‘excel’,<br />
[/js]</p>
<p>Then you will get a filtering option as follows:</p>
<div id="attachment_9041" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6.jpg"><img decoding="async" aria-describedby="caption-attachment-9041" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="407" class="size-full wp-image-9041" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6.jpg 570w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6-300x188.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6-400x250.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9041" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<p>To enable the tooltip add the following line to your grid settings<br />
[js]<br />
enabletooltips: true,<br />
[/js]</p>
<p>To apply themes add the following line to your grid settings<br />
[js]<br />
theme: ‘metro’,<br />
[/js]</p>
<p>Please be noted that you must include the style sheet accordingly, In this case you have to include the following<br />
[html]<br />
&lt;link href=“~/jqwidgets/styles/jqx.metro.css” rel=“stylesheet” /&gt;<br />
[/html]</p>
<p>You can find so many CSS in <em>jqwidgets/styles</em> folder.</p>
<p>To enable auto height add the following line to your grid settings<br />
[js]<br />
autoheight: true,<br />
[/js]</p>
<p>To show the default filter icon always add the following line to your grid settings<br />
[js]<br />
autoshowfiltericon: false,<br />
[/js]</p>
<p>Happy Coding 🙂</p>
<p><strong>History</strong></p>
<p>First Version: 20-Oct-2014<br />
Second Version: 23-Oct-2014</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/advanced-jqx-grid-with-all-functionality/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
	</channel>
</rss>
