0

Asp.net MVC4, jqgrid 4.4.4 및 jquery 1.9로 작업 중입니다. jqGrid가 쿼리에서 데이터베이스로로드되었지만 필드를 필터링 할 수 없습니다. 값을 넣으면 검색되지 않지만 동일한 값을 표시하지만 jqgrid에서 값을 정의하면 loadonce : 첫 번째 검색 페이지에서만 true, 어떻게이 문제를 해결할 수 있습니까? 어디에서 코드를 수정해야합니까? 데이터베이스에서 jqgrid로드가 작동하지 않습니다. filterToolbar

내 코드,있는 jqGrid입니다 : 필터링이 컨트롤러에 의해 처리됩니다 기본적으로

jQuery(document).ready(function() { 
     jQuery("#tbBuscaRec").jqGrid({ 
      url: '@Url.Action("DatosBuscaPersona", "raTabPersonaReclamante")', 
      datatype: 'json', 
      mtype: 'POST',  
      postData: { Parametro: Param }, 
      colNames: ['Id', 'IdPer', 'Doc', 'CI/NIT', 'Nombres', 'Apellido Paterno', 'Apellido Materno', 'Apellido Esposo'], 
      colModel: 
      [ 
       { name: 'ip_idpersona', index: 'ip_idpersona', formatter: 'number', hidden: true }, 
       { name: 'ip_idpersonadoc', index: 'ip_idpersonadoc', formatter: 'text', hidden: true }, 
       { name: 'ip_partipodoc', index: 'ip_partipodoc', align: 'left', width: '4', editable: true, edittype: 'text', editoptions: { readonly: true }, search: false }, 
       { name: 'ip_nrodoc', index: 'ip_nrodoc', sortable: true, align: 'left', width: '8', editable: true, edittype: 'text', editoptions: { readonly: true} }, 
       { name: 'ip_nombres', index: 'ip_nombres', sortable: true, align: 'left', width: '15', editable: true, edittype: 'text', editoptions: { readonly: true} }, 
       { name: 'ip_appaterno', index: 'ip_appaterno', sortable: true, align: 'left', width: '15', editable: true, edittype: 'text', editoptions: { readonly: true } }, 
       { name: 'ip_apmaterno', index: 'ip_apmaterno', sortable: true, align: 'left', width: '15', editable: true, edittype: 'text', editoptions: { readonly: true} }, 
       { name: 'ip_apesposo', index: 'ip_apesposo', sortable: false, align: 'left', width: '15', editable: true, edittype: 'text', editoptions: { readonly: true} } 
      ], 
      pager: '#pg_tbBuscaRec', 
      rowNum: 100, 
      rowList: [100, 200, 300], 
      sortname: 'ip_nombres', 
      sortorder: 'asc', 
      rownumbers: true, 
      multiselect: false, 
      gridview: true, 
      height: 180, 
      width: 490, 
      ignoreCase: true, 
//   loadonce: true, 
     }); 
    }); 
    jQuery("#tbBuscaRec").jqGrid('navGrid', '#pg_tbBuscaRec', { view: false, edit: false, add: false, del: false }, {}, {}, {}, { multipleSearch: true, closeAfterSearch: true, closeOnEscape: true }); 
    jQuery("#tbBuscaRec").jqGrid('filterToolbar'); 
    jQuery("#tbBuscaRec").trigger("reloadGrid", [{ current: true}]); 
+0

: 컨트롤러 액션'@의 Url.Action TRUE '("DatosBuscaPersona를", "raTabPersonaReclamante")'** 모든 데이터 ** (대신 한 페이지의 반환해야 데이터)를'sidx'와'sord'에 대응하여 정렬합니다. 또는 ** 서버 측 필터링 **을 구현해야합니다 (Mark의 답변 참조). – Oleg

답변

1

, 당신은이 값이 _searchfilters의 컨트롤러에 전달되는 볼 수 있습니다.

첫 번째 페이지에서 loadonce: true이 작동하는 이유는 클라이언트 쪽에서 필터링을 수행하고 있기 때문입니다.

아래 링크에서 필터링에 대한 Oleg의 답변을 확인하는 것이 좋습니다. 내 응용 프로그램에 대한 필터링을 서버 측에서 수행하기 위해 트랙에 넣는 것입니다. 당신이 loadonce`사용하려는 경우

ASP.NET MVC 2.0 Implementation of searching in jqgrid