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
jqGrid client-side searching with filterToolbar
21/09/2013
14:35
Avatar
aram87
New Member
Members
Forum Posts: 1
Member Since:
21/09/2013
sp_UserOfflineSmall Offline

I am trying to enable the client-side searching feature of the jqGrid through the filterToolbar method, yet I am unable to make it work. The grid is loading data correctly through JSON that is being returned from an asmx service on page load (document.ready), yet when I try to search through any of the columns using the search toolbar, the grid only refreshes without searching.

I have already checked other similar questions and their answers, but none of them helped me solve my issue. Maybe someone can check my jqGrid script below and tell me what is wrong with it or what is there missing. For the reference, I am using the version "4.5.2" of jqGrid.

$('#tblTargetDetails').jqGrid({ url: 'PostHandlers/CommonHandler.asmx/GetTargetDetails', datatype: 'json', ajaxGridOptions: { contentType: 'application/json; charset=utf-8' }, ajaxRowOptions: { contentType: "application/json; charset=utf-8", dataType: "json" }, postData: "{'TargetID': '" + TargetID + "'}", mtype: 'POST', colNames: ['Team ID', 'Member UserID', 'Measure', 'Product', 'Month1', 'Month2'], colModel: [ { name: 'TeamID', index: 'TeamID', width: 55, search: true, sorttype: 'int' }, { name: 'MemberUserID', index: 'MemberUserID', width: 90, search: true, stype: 'text' }, { name: 'Measure', index: 'Measure', width: 90, search: true, searchoptions: {} }, { name: 'Product', index: 'Product', width: 90, search: true }, { name: 'Month1', index: 'Month1', width: 80, editable: true, search: true }, { name: 'Month2', index: 'Month2', width: 80, editable: true, search: false }], jsonReader: { root: "d.TargetDetails", records: "d.RecordsCount", id: "ID", cell: "", page: function () { return 1; }, total: function () { return 1; }, }, pager: '#pnlTargetDetails', rowNum: 50, rowTotal: 2000, rowList: [20, 30, 50], loadonce: true, viewrecords: true, gridview: true, ignoreCase: true, rownumbers: true, caption: 'Target Details', editurl: 'PostHandlers/CommonHandler.asmx/EditTargetDetail', serializeRowData: function (postData) { return JSON.stringify({ 'content': JSON.stringify(postData), 'UserID': UserID }); }, onSelectRow: function (id) { if (id && id !== lastSel) { $('#tblTargetDetails').restoreRow(lastSel); lastSel = id; } $('#tblTargetDetails').jqGrid('editRow', id, true); } }); $('#tblTargetDetails').jqGrid('navGrid', '#pnlTargetDetails', { search: true, edit: false, add: false, del: false }); $('#tblTargetDetails').jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false });
23/09/2013
14:14
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

I'm not sure, but you set id:ÏD but it is not in the colModel.

Irecommend you to set key: true in a column which has unique values by example:

name: 'TeamID', index: 'TeamID', width: 55, search: true, sorttype: 'int', key: true

Also can you please post a simple data returned from the server?, so that I can see what is happen.
Thank you

Kind Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
29 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