Home › Forums › Guriddo jqGrid JS › Search Operators Dissappeared
Tagged: jqgid serachoptions sopts
I have been working on a page with a jqgrid for a few days now and all of the sudden my search operators will no longer show in the drop down on my single field search box. The searchable fields show just fine, but there are no options added to the select for the operators.
The field is being rendered as:
<td class=”operators”><select class=”selectopts ui-widget-content ui-corner-all”></select></td>
Here is the initializer:
<table id=”jqGrid”></table>
<script type=”text/javascript”>
$(document).ready(function() {
$(“#jqGrid”).jqGrid({
url: ‘/Admin/getContactJson’,
editurl: ‘/Admin/updateContact’,
mtype: “GET”,
datatype: “json”,
colModel: [
{ label: ‘Id’, name: ‘Id’, key: true, width: 30, search: false },
{ label: ‘First’, name: ‘FirstName’, key: false, width: 100, search: true, searchoptions: { sopt: [“eq”, “ne”, “bw”, “bn”, “ew”, “en”, “cn”, “nc”] }, editable: true, edittype: ‘text’ },
{ label: ‘Last’, name: ‘LastName’, key: false, width: 100, search: true, searchoptions: { sopt: [“eq”, “ne”, “bw”, “bn”, “ew”, “en”, “cn”, “nc”] }, editable: true, edittype: ‘text’ },
{ label: ‘Add 1’, name: ‘Address1’, key: false, width: 100, search: true, searchoptions: { sopt: [“eq”, “ne”, “bw”, “bn”, “ew”, “en”, “cn”, “nc”] }, editable: true, edittype: ‘text’ },
{ label: ‘Add 2’, name: ‘Address2’, key: false, width: 100, search: false, editable: true, edittype: ‘text’ },
{ label: ‘City’, name: ‘City’, key: false, width: 100, search: false, editable: true, edittype: ‘text’ },
{ label: ‘State’, name: ‘State’, key: false, width: 30, search: false, editable: true, edittype: ‘text’ },
{ label: ‘Zip’, name: ‘Zip’, key: false, width: 50, search: false, editable: true, edittype: ‘text’ },
{ label: ‘Home’, name: ‘HomePhone’, key: false, width: 80, search: true, searchoptions: { sopt: [“eq”, “ne”, “bw”, “bn”, “ew”, “en”, “cn”, “nc”] }, editable: true, edittype: ‘text’ },
{ label: ‘Work’, name: ‘WorkPhone’, key: false, width: 80, search: true, searchoptions: { sopt: [“eq”, “ne”, “bw”, “bn”, “ew”, “en”, “cn”, “nc”] }, editable: true, edittype: ‘text’ },
{ label: ‘Cell’, name: ‘CellPhone’, key: false, width: 80, search: true, searchoptions: { sopt: [“eq”, “ne”, “bw”, “bn”, “ew”, “en”, “cn”, “nc”] }, editable: true, edittype: ‘text’ },
{ label: ‘Email’, name: ‘Email’, key: false, width: 200, search: true, searchoptions: { sopt: [“eq”, “ne”, “bw”, “bn”, “ew”, “en”, “cn”, “nc”] }, editable: true, edittype: ‘text’, editrules: { required: false, email: true }}
],
rowNum: 25,
sortname: “Id”,
sortorder: “asc”,
viewrecords: true,
gridview: true,
autoencode: true,
height: “auto”,
width: “auto”,
hoverrows: false,
jsonReader: {
root: “rows”,
page: “page”,
total: “total”,
records: “records”,
repeatitems: false,
cell: “cell”,
id: “id”,
userdata: “userdata”,
subgrid: {
root: “rows”,
repeatitems: false,
cell: “cell”
}
},
pager: “#jqGridPager”
});
$(‘#jqGrid’).navGrid(“#jqGridPager”, {
search: true, // show search button on the toolbar
add: false,
edit: true,
del: false,
refresh: true
},
{
editCaption: “Edit a Contact”,
recreateForm: true,
closeAfterEdit: true,
errorTextFormat: function(data) {
return “Error: ” + data.responseText;
}
});
});
</script>
Not sure what I did. They were working great and at some point they just went away. After I got the search working as I wanted, I implemented the edit functionality. After getting that going, I went back to test and the operators were missing. I don’t think that adding the editing had anything to do with it, but you never know.
TIA for any ideas!
Trent
Hello,
I had tried the above code and it works fine for me. Search operators are showing. But I’ve had a similar problem a while ago. The problem was with the language files. I downloaded newer version of jqGrid and the problem was solved. You should try it. Be sure to replace your lang and css files from the latest version.
Let me know if that works.
Regards,
Petar
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top