0

I've been searching for a solution to my situation for a couple of days now, and I cannot seem to find anything that could help me.

I am allowing my users the make a custom search on the DB using a simple form, and then the server sends back a JSON encoded object that represents the results(this part functions properly).

The problem is that the grid is not being refreshed, and I cannot seem to display those results.

I've tried to do the following thing, but it just refreshes the grid one more time and then shows me all of the results without any search being made.

Can I adjust jqgrid in a certain way to display the search results?.

After I'll accomplish this, I would also like to combine my system with the sorting and paging abilities of jqgrid(allow my customers to page and sort their results).

Thanks for your help in advance guys!.

enter code here

 $(function() {

    $("#list2").jqGrid({
        url:'applicants.temp.php',
        datatype: "json",
         width: 900,
         height: 300,
         scroll: false,
         shrinktofit: false,
         gridview: true,
         direction: '<?=$web_direction?>',
         colNames:['id', '<?=$mylabel["last_updated"]?>', '<?=$mylabel["job_title"]?>', '<?=$mylabel["applicant_name"]?>', '<?=$mylabel["cv_filename"]?>', '<?=$mylabel["referer_name"]?>',
        '<?=$mylabel["note"]?>', '<?=$mylabel["media_id"]?>', '<?=$mylabel["ref_type"]?>', '<?=$mylabel["job_internal_id"]?>', 'status_id', 'job_id', ''],
          colModel:[
          {name: 'id',index:'2', width:10, hidden: true, align:'<?=$col_direction?>'},
          {name:'last_updated', index:'1', width:20, align:'<?=$col_direction?>'},
          {name:'job_title',index:'8', width: 20, align:'<?=$col_direction ?>'},
          {name:'applicant_name', index:'3', width:40, align:'<?=$col_direction?>'},
          {name:'cv_filename',index:'11', width:30, align:'center'}, 
          {name:'referer_name', index:'4', width:40, align:'<?=$col_direction?>'},
          {name:'note',index:'10', width:60, align:'<?=$col_direction?>'},  
          {name:'media_id',index:'5', width:20, align:'<?=$col_direction?>'},    
          {name:'ref_type',index:'6', width:20, align:'<?=$col_direction?>'}, 
          {name:'job_internal_id',index:'9', width:15, hidden: false, align:'
          <?=$col_direction?>'}, 
          {name:'status_id',index:'12', hidden:true, width:0, align:'<?=$col_direction?                             >'},
          {name:'job_id',index:'7', hidden:true, width:0, align:'<?=$col_direction?>'},
          {name:'empty', width:60, sortable:false ,index:'13', hidden:'hidden',  align:'center'}

        ],
        rowNum:20,
        rowList:[20,40,60],
        pager: '#pager2',
        sortname: '1',
        viewrecords: true,
        sortorder: "DESC",
        caption:"<?=get_phrase("Applicants")?>",
        loadonce:false,
        postData: { medias: function(){return $("#medias option:selected").val();},
                    types: function(){return $("#types option:selected").val();},
                    jobs: function(){return $("#jobs option:selected").val();},
                    applicant: function(){return $("#applicant").val();},
                    referrer: function(){return $("#referrer").val();} }

    });

});

Oleg Belousov
  • 9,981
  • 14
  • 72
  • 127

1 Answers1

1

You should include the code which shows how you create the grid. The only code which related to jqGrid is the line $('#grid').trigger('reloadGrid');, but I don't see that you make any changes on the grid before reloading. So you have probably the same grid results as before.

I recommend you to read the answer which describe how you can send to the server additional custom information from controls which you can use on the backend to filter the data. I suppose that you can solve your problem if you follow the way.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thank you very much Oleg!. You are definitely one of the most appriciapted JQgrid and Qjuery experts!. Now if I just could solve the annoting horizental scroll bar bug(your css solution doesn't seem to work for me), that would be idial. Thank you so much again dear man!. – Oleg Belousov Jan 06 '13 at 13:45
  • @OlegTikhonov: You are welcome! The problem with horizontal scrollbars is the problem of conflicts of jqGrid CSS and other CSS which you use. Such problem need be analysed and be solved using Firebug or Developer Tools of IE or Chrome. The tools provide you way to trace the CSS of different elements. So the problem with CSS could be solved in the way I think. – Oleg Jan 06 '13 at 14:33
  • Hello again Oleg, I have tried to implement the solution that you had offered in this thread: http://stackoverflow.com/questions/5647313/unnecessary-horizontal-scrollbar-jqgrid But unfortunately, it didn't work for me. Is there any other way arround this issue?. Thanks in advance, Oleg. – Oleg Belousov Jan 06 '13 at 15:26
  • @OlegTikhonov: The referenced answer solve conflicts between standard CSS of Microsoft ASP.NET MVC and `ui.jqgrid.css`. You use PHP, so you have sure *another problem*. One have to analyse your specific problems and suggest workaround which works in your specific case. – Oleg Jan 06 '13 at 15:34
  • overriting the following CSS setting: able-layout: auto; did eleminate the scrolling bar, but had also messed up the alignment of the colNames in front of the cols, and left the last column on the right unvisible. – Oleg Belousov Jan 06 '13 at 15:49
  • @OlegTikhonov: Sorry, but I can't help you to solve the issue with CSS because I don't see the page which has the problem which you describe. – Oleg Jan 06 '13 at 16:09
  • Hi agin Oleg, I tried to modify my code, but with now luck. here is the grid part if that could help you to help me: – Oleg Belousov Jan 06 '13 at 17:26