Jump to content

Recommended Posts

Posted

looking through the search functions when viewing all pilots in my admin, i notice i cant search for the ID. Going into Admin/templates/pilot-list.tpl i see this:

<script type="text/javascript">
$("#grid").jqGrid({
  url: '<?php echo adminaction('/pilotadmin/getpilotsjson');?>',
  datatype: 'json',
  mtype: 'GET',
  colNames: ['','First', 'Last', 'Email', 'Location', 'Status', 'Rank', 'Flights', 'Hours', 'IP', 'Edit'],
  colModel : [
               {index: 'id', name: 'id', hidden: true, search: false },
               {index: 'firstname', name : 'firstname',sortable : true, align: 'left', search: 'true', searchoptions:{sopt:['in']}},
               {index: 'lastname', name : 'lastname',  sortable : true, align: 'left', searchoptions:{sopt:['in']}},
               {index: 'email', name : 'email', sortable : true, align: 'left',searchoptions:{sopt:['li']}},
               {index: 'location', name : 'location',  sortable : true, align: 'center',searchoptions:{sopt:['eq','ne']}},
               {index: 'status', name : 'status', sortable : true, align: 'center',searchoptions:{sopt:['in']}},
               {index: 'rank', name : 'rank', sortable : true, align: 'center', searchoptions:{sopt:['eq','ne']}},
               {index: 'totalflights', name : 'totalflights', sortable : true, align: 'center',searchoptions:{sopt:['lt','gt']}},
               {index: 'totalhours', name : 'totalhours', sortable : true, align: 'center',searchoptions:{sopt:['lt','gt']}},
               {index: 'lastip', name : 'lastip', sortable : true, align: 'center', searchoptions:{sopt:['in']}},
               {index: '', name : '', sortable : true, align: 'center', search: false}
       ],
   pager: '#pager', rowNum: 25,
   sortname: 'lastname', sortorder: 'asc',
   viewrecords: true, autowidth: true,
   height: '100%'
});

jQuery("#grid").jqGrid('navGrid','#pager', 
       {edit:false,add:false,del:false,search:true,refresh:true},
       {}, // edit 
       {}, // add 
       {}, //del 
       {multipleSearch:true} // search options 
); 
</script>

i changed it to this to include the Id field, but i dont return any id numbers:

<script type="text/javascript">
$("#grid").jqGrid({
  url: '<?php echo adminaction('/pilotadmin/getpilotsjson');?>',
  datatype: 'json',
  mtype: 'GET',
  colNames: ['Id','First', 'Last', 'Email', 'Location', 'Status', 'Rank', 'Flights', 'Hours', 'IP', 'Edit'],
  colModel : [
	{index: 'id', name: 'id',sortable : true, align: 'left', search: 'true', searchoptions: {sopt:['in']}},
	{index: 'firstname', name : 'firstname',sortable : true, align: 'left', search: 'true', searchoptions:{sopt:['in']}},
	{index: 'lastname', name : 'lastname',  sortable : true, align: 'left', searchoptions:{sopt:['in']}},
	{index: 'email', name : 'email', sortable : true, align: 'left',searchoptions:{sopt:['li']}},
	{index: 'location', name : 'location',  sortable : true, align: 'center',searchoptions:{sopt:['eq','ne']}},
	{index: 'status', name : 'status', sortable : true, align: 'center',searchoptions:{sopt:['in']}},
	{index: 'rank', name : 'rank', sortable : true, align: 'center', searchoptions:{sopt:['eq','ne']}},
	{index: 'totalflights', name : 'totalflights', sortable : true, align: 'center',searchoptions:{sopt:['lt','gt']}},
	{index: 'totalhours', name : 'totalhours', sortable : true, align: 'center',searchoptions:{sopt:['lt','gt']}},
	{index: 'lastip', name : 'lastip', sortable : true, align: 'center', searchoptions:{sopt:['in']}},
	{index: '', name : '', sortable : true, align: 'center', search: false}
],
   pager: '#pager', rowNum: 25,
   sortname: 'lastname', sortorder: 'asc',
   viewrecords: true, autowidth: true,
   height: '100%'
});

jQuery("#grid").jqGrid('navGrid','#pager', 
{edit:false,add:false,del:false,search:true,refresh:true},
{}, // edit 
{}, // add 
{}, //del 
{multipleSearch:true} // search options 
); 
</script>

Could someone point me in the right direction.

Thanks

Alex

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...