<?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: Search on local array</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/search-on-local-array</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/bugs/search-on-local-array/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>mestevez on Search on local array</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/search-on-local-array#p28405</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/search-on-local-array#p28405</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>First of all I want to show the code I&#39;m using:</p>
</p>
<p>$(document).ready(function () {</p>
<p><span style="white-space: pre;"><span style="white-space: pre;"> </span> </span>var mydata = [</p>
<p><span style="white-space: pre;"><span style="white-space: pre;"> </span> </span>[0,"IT000","ITEM0"],</p>
<p><span style="white-space: pre;"><span style="white-space: pre;"> </span> </span>[1,"IT001","ITEM1"],</p>
<p><span style="white-space: pre;"><span style="white-space: pre;"> </span> </span>[2,"IT003","ITEM3"],</p>
<p><span style="white-space: pre;"><span style="white-space: pre;"> </span> </span>[3,"IT004","ITEM4"],</p>
<p><span style="white-space: pre;"><span style="white-space: pre;"> </span> </span>];</p>
<p><span style="white-space: pre;"> </span>var grid = $("#table");</p>
<p><span style="white-space: pre;"> </span>grid.jqGrid({</p>
<p><span style="white-space: pre;"> </span>cmTemplate : {</p>
<p><span style="white-space: pre;"> </span>search			: true,</p>
<p><span style="white-space: pre;"> </span>searchoptions	: { sopt : ["cn","nc","eq","ne","bw","bn","in","ni","ew","en"] }</p>
<p><span style="white-space: pre;"> </span>},</p>
<p><span style="white-space: pre;"> </span>colModel 	: [</p>
<p><span style="white-space: pre;"> </span>{ name: "id", 	index: "id", 	width: 20, sorttype: "int" 	}, 			{ name: "code", index: "code",	width: 40, sorttype: "text" },</p>
<p><span style="white-space: pre;"> </span>{ name: "name", index: "name", 	width: 80, sorttype: "text" }</p>
<p><span style="white-space: pre;"> </span>],</p>
<p><span style="white-space: pre;"> </span>colName		: [],</p>
<p><span style="white-space: pre;"> </span>data		: mydata,</p>
<p><span style="white-space: pre;"> </span>datatype	: "local",</p>
<p><span style="white-space: pre;"> </span>localReader : { 			cell		: "", 			id			: "", 			repeatitems : true 		},</p>
<p><span style="white-space: pre;"> </span>height	: "auto",</p>
<p><span style="white-space: pre;"> </span>search	: true</p>
<p><span style="white-space: pre;"> </span>});</p>
<p><span style="white-space: pre;"> </span>grid.jqGrid("filterToolbar");</p>
<p>})</p>
</p>
<p>The problem I found is that search on client side is not working when trying to use data as an array. Aparently, the problem is that the getAccessor method receive, as expr parameter,&#160;the colModel name , whilst the obj parameter contains the real array, without any reference to column names. Therefore, the method is not able to extract the value from the obj parameter.</p>
<p>Generally, the most grid examples I&#39;ve seen uses arrays which contains a JSON structure ([{id: 0, code: "IT001", name: "ITEM1"}, { ... }, ...]). However, I use a more simple format ([ [0, "IT001", "ITEM1"], [ ... ], &#8230;]). The reason for using this format is because I manage a huge amount of rows and columns (generally with long names) and I have to optimize the data as much as possible.</p>
</p>
<p>I would kwnow if it is a bug, a lag of functionality or if I&#39;m doing something wrong when setting the grid.</p>
</p>
<p>Thank&#39;s for your attention</p>
]]></description>
        	        	<pubDate>Wed, 06 Mar 2013 15:49:12 +0200</pubDate>
        </item>
</channel>
</rss>