<?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>Change Header Names Dynamically In JQwidgets JQX grid &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/change-header-names-dynamically-in-jqwidgets-jqx-grid/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 28 Oct 2015 11:17:33 +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>Change Header Names Dynamically In JQwidgets JQX grid &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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 fetchpriority="high" 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>
	</channel>
</rss>
