Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Search on local array
06/03/2013
15:49
Avatar
mestevez
Barcelona
Member
Members
Forum Posts: 3
Member Since:
06/03/2013
sp_UserOfflineSmall Offline

Hello,

First of all I want to show the code I'm using:

$(document).ready(function () {

var mydata = [

[0,"IT000","ITEM0"],

[1,"IT001","ITEM1"],

[2,"IT003","ITEM3"],

[3,"IT004","ITEM4"],

];

var grid = $("#table");

grid.jqGrid({

cmTemplate : {

search : true,

searchoptions : { sopt : ["cn","nc","eq","ne","bw","bn","in","ni","ew","en"] }

},

colModel : [

{ name: "id", index: "id", width: 20, sorttype: "int" }, { name: "code", index: "code", width: 40, sorttype: "text" },

{ name: "name", index: "name", width: 80, sorttype: "text" }

],

colName : [],

data : mydata,

datatype : "local",

localReader : { cell : "", id : "", repeatitems : true },

height : "auto",

search : true

});

grid.jqGrid("filterToolbar");

})

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, 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.

Generally, the most grid examples I'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"], [ ... ], …]). 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.

I would kwnow if it is a bug, a lag of functionality or if I'm doing something wrong when setting the grid.

Thank's for your attention

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
85 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information