<?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: Problem setting data option</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/problem-setting-data-option</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/problem-setting-data-option/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>christine_draper on Problem setting data option</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/problem-setting-data-option#p29284</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/problem-setting-data-option#p29284</guid>
        	        	<description><![CDATA[<p>Ah! Thanks - it worked when I fixed the attribute name to datatype. Can&#39;t believe how long I stared at that without seeing it.</p>
]]></description>
        	        	<pubDate>Tue, 06 Aug 2013 14:53:23 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Problem setting data option</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/problem-setting-data-option#p29279</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/problem-setting-data-option#p29279</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>The code that will workmost eficently is this</p>
<p>&#8230;</p>
<div>var data = [ {  "item":"1","title":"A title" }, {  "item":"2","title":"A second title" } ];</div>
<div>var obj = {};</div>
<div><strong>obj.datatype="local";</strong></div>
<div>obj.width= 700;</div>
<div>obj.height=400;</div>
<div>obj.colNames= ["Item #", "Title"]</div>
<div>obj.colModel= [{name:&#39;item&#39;,width:&#39;50&#39;}, {name:&#39;title&#39;,width:&#39;100&#39;}  ];</div>
<div>&#60;!&#8211; Shouldn&#39;t setting obj.data = data work instead of setting empty then using for loop? &#8211;&#62;</div>
<div><strong>obj.data = data;</strong></div>
<div>var grid =	$("#my-table").jqGrid(obj);</div>
<div>&#8230;</div>
<div>See data parameter in the docs and datatype is set wrong</div>
<div>Regards</div>
]]></description>
        	        	<pubDate>Tue, 06 Aug 2013 11:29:27 +0300</pubDate>
        </item>
        <item>
        	<title>christine_draper on Problem setting data option</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/problem-setting-data-option#p29272</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/problem-setting-data-option#p29272</guid>
        	        	<description><![CDATA[<p>I figured out I can set all the data at once by using:</p>
<p>grid.addRowData("item", mydata);</p>
<p>Which I hope is more efficient than adding rows individually. Still curious about why the above didnt work, but not blocked anymore.</p>
]]></description>
        	        	<pubDate>Sun, 04 Aug 2013 22:40:06 +0300</pubDate>
        </item>
        <item>
        	<title>christine_draper on Problem setting data option</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/problem-setting-data-option#p29269</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/problem-setting-data-option#p29269</guid>
        	        	<description><![CDATA[<p>I&#39;m trying to set the data for a grid from an array. &#160;The code below is what I got to work, but I thought I should be able to do it by setting the data option to mydata array either when I create the grid, or using setGridParam. I&#39;m new to this.. appreciate if you can help me understand why these other approaches don&#39;t work.&#160;</p>
</p>
<div>$(function(){</div>
<div><span style="white-space:pre"> </span>var data = [ {  "item":"1","title":"A title" }, {  "item":"2","title":"A second title" } ];</div>
<div><span style="white-space:pre"> </span>var obj = {};</div>
<div><span style="white-space:pre"> </span>obj.dataType="local";</div>
<div><span style="white-space:pre"> </span>obj.width= 700;</div>
<div><span style="white-space:pre"> </span>obj.height=400;</div>
<div><span style="white-space:pre"> </span>obj.colNames= ["Item #", "Title"]</div>
<div><span style="white-space:pre"> </span>obj.colModel= [{name:&#39;item&#39;,width:&#39;50&#39;}, {name:&#39;title&#39;,width:&#39;100&#39;}  ];</div>
<div><span style="white-space:pre"> </span>&#60;!-- Shouldn&#39;t setting obj.data = data work instead of setting empty then using for loop? --&#62;</div>
<div><span style="white-space:pre"> </span>obj.data = [];</div>
<div><span style="white-space:pre"> </span>var grid =	$("#my-table").jqGrid(obj);</div>
<div><span style="white-space:pre"> </span>&#60;!-- This is what I could get to work --&#62;</div>
<div>
<div><span style="white-space: pre;"> </span>for(var i=0;i&#60;=mydata.length;i++) {</div>
<div><span style="white-space: pre;"> </span>grid.addRowData(i+1,mydata[i]);</div>
<div><span style="white-space: pre;"> </span>};</div>
</div>
<div><span style="white-space:pre"> </span>&#60;!-- Should using setGridParam("data", data) work instead of the for loop? --&#62;</div>
<div><span style="white-space:pre"> </span>var griddata = grid.setGridParam("data", data);</div>
<div>});</div>
]]></description>
        	        	<pubDate>Sat, 03 Aug 2013 01:10:55 +0300</pubDate>
        </item>
</channel>
</rss>