<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: How to handle dynamic colModel ?</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-handle-dynamic-colmodel</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/how-to-handle-dynamic-colmodel/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on How to handle dynamic colModel ?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-handle-dynamic-colmodel#p12270</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-handle-dynamic-colmodel#p12270</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Sorry but I do not understand what you exactley mean with dynamic colModel.</p>
<p>If you want this to happen after every request - i.e. after you use pagging sorting and etc., this is not possible.</p>
<p>The type of error definetley say that you have diffrent definition of colModel and colNames.</p>
<p>In order to solve this problem, you can remove the colNames definition from grid parameters and use the label attribute in colModel something like this.</p>
<p><input type='button' class='sfcodeselect' name='sfselectit511' value='Select Code' data-codeid='sfcode511' /></p>
<div class='sfcode' id='sfcode511'>
<p>....</p>
<p>var t = "{label: \\"Mylabel\\" name:" + "\\&#39;Act\\&#39;," +"&#160; index: " + "\\&#39;Act\\&#39;};</p>
</div>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 21 Nov 2009 07:34:32 +0200</pubDate>
        </item>
        <item>
        	<title>ellenecho on How to handle dynamic colModel ?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-handle-dynamic-colmodel#p12197</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-handle-dynamic-colmodel#p12197</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I am trying to customize jqgrid into my project. What I wish to accomplish here is to define the grid the following way:</p>
<p><span style="font-size: x-small;"><span style="font-size: x-small;"></span></span></p>
<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
</p>
<p><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;"><span style="color: #000000;">colModel: getColNames(</span>&#39;&#60;%= ViewData["myColsNames"] %&#62;&#39;</span></span><span style="font-size: x-small;">),</span></p>
</p>
<p><span style="font-size: x-small;"><span style="font-size: x-small;">colModel: getColModel(&#8221;<span style="color: #a31515;">&#39;&#60;%= ViewData["myColsNames"] %&#62;&#39;&#8221;), </span></span></span></p>
<p><span style="font-size: x-small;"><span style="color: #000000;">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.</span></span></p>
</p>
<p>where the<span style="color: #0000ff;"> getColNames </span>will return an array of strings with the column names that I saved in the view data and the <span style="color: #0000ff;">getColModels <span style="color: #000000;">returns similar array of strings in the format of </span><span style="font-size: x-small; color: #008000;"><span style="font-size: x-small; color: #008000;"></span></span></span></p>
<p>{name: &#39;act&#39;, index: &#39;act&#39;, width: 75, sortable: false },</p>
<p>&#8230;</p>
</p>
<p>When calling the colNames alone&#160;with hardcoded colModel, the table looks fine. But when I try&#160;using getColModels, it does not work and give an error messsage &#8220;length of colName &#60;&#62; colModel&#8221;. . I wonder how could I make the grid take the dynamically defined colModel?</p>
</p>
<p>Currently the getColModel procedure look like the following:</p>
<p>function(myinput){</p>
<p><span style="color: #339966;">//I am mocking up just one column in the table with the corresponding colName set to only one colmn</span></p>
</p>
<p><span style="font-size: x-small; color: #008000;"><span style="font-size: x-small; color: #008000;"></span></span></p>
<p>var t = &#8220;{name:&#8221; + &#8220;\\&#39;Act\\&#39;,&#8221; + &#8221; index: &#8221; + &#8220;\\&#39;Act\\&#39;}&#8221;;</p>
<p>return t;</p>
</p>
<p><span style="font-size: x-small;">}</span></p>
</p>
<p><span style="font-size: x-small;">Do you have any idea how I could get over with this? I see that colModel is an array of objects. can I defined it on my own colModel dynamically like this?</span></p>
</p>
<p><span style="font-size: x-small;">Any help or comment is appreciated. Thank you!</span></p>
</p>
<p><span style="font-size: x-small;">Ellen</span></p></p>
]]></description>
        	        	<pubDate>Thu, 19 Nov 2009 13:05:06 +0200</pubDate>
        </item>
</channel>
</rss>