2012-07-30 4 views
0

로컬 데이터 필터링에 문제가 있습니다. loadonce 매개 변수를 제거하고 서버에서 결과를 가져 오는 것이 좋습니다. 로컬 데이터에서 필터를 원할 때 문제가 나타납니다. 이 내 그리드 구현 :jqGrid filterToolbar 및 로컬 검색이 작동하지 않습니다.

orderPosGrid.jqGrid({ 
     colNames: ['', '', '', '', '', '', '', 'ID', 'Nazwa/Rodzaj', 'Ilość', 'Jedn.', 'Przyczyna zwrotu', 'Napis', '', ''], 
     colModel: [ 
      {name: 'myac', index:'myac', width:0, hidden:true}, 
      {name: 'commited', index: 'commited', width: 0, editable: false, hidden: true}, 
      {name: 'hasIlosc', index: 'hasIlosc', width: 0, editable: false, hidden: true}, 
      {name: 'hasOpis', index: 'hasOpis', width: 0, editable: false, hidden: true}, 
      {name: 'opisCount', index: 'opisCount', width: 0, editable: false, hidden: true}, 
      {name: 'id', index: 'id', width: 0, sorttype: 'int', editable: false, hidden: true}, 
      {name: 'qType', index: 'qType', width: 0, sorttype: 'int', editable: false, hidden: true}, 
      {name: 'id_prod', index: 'id', width: 30, sorttype: 'int', editable: false}, 
      {name: 'nazwa', index: 'name', width: 250, editable: false}, 
      {name: 'ilosc', index: 'quantity', width: 35, align: 'right', sortable: false, search:false, edittype:'text', editable: true, editrules:{custom:true, custom_func:iloscValidate, minValue:1}}, 
      {name: 'jedn', index: 'jedn', width: 35, sortable: false, search:false, align: 'right', editable: false}, 
      {name: 'opisZwrot', index: 'opisZwrot', width: 170, sortable: false, editable: true, search:false, edittype:'select', formatter: 'select', editoptions:{value:'{{ przyczZwrot }}'}}, 
      {name: 'opis', index: 'description', width: 170, sortable: false, search:false, editable: true}, 
      {name: 'group', index: 'group', editable: false, hidden: true}, 
      {name: 'info', index: 'info', sortable: false, search:false, width: 22} 
     ], 
     status: 0, 
     url: '/ProdList/'+type_id+'/'+order_id+'/', 
     datatype: 'json', 
     mtype: 'GET', 
     ignoreCase:true, 
     height: 'auto', 
     rowNum: 10000, 
     loadonce:true, 
     gridview: true, 
     viewrecords: true, 
     sortname: '', 
     sortorder: '', 
     pager: '#ProdList_gridPager', 
     caption: 'Lista dostępnych produktów', 
     subGrid: false, 
     editurl: 'clientArray', 
     grouping: true, 
     groupingView: { 
      groupField: ['group'], 
      groupOrder: ['asc'], 
      groupColumnShow: [false], 
      groupText: ['<b>{0} [{1}]</b>'], 
      groupCollapse: false 
     }, 
... 
}); 

내가 두 필드에만 필터링 할 수 있습니다 ID와로 비슷, 다른 사람은 사용할 수 없습니다. 같은 서버에서 내 JSON 데이터 보인다 : 나는 일반적인 데이터 구성을 사용하고 jsonReader 구성이 필요하지 않습니다 생각

{"total":1, "page":"1", "records":"266", "rows":[{"id": "2473_1", "cell":["","1","0","0","","116","1","2473","Adwokat","3","kg.","","","d - Ciasta kremowo-śmietanowe"]},{"id": "2473_2", "cell":["","1","0","0","","116","1","2473","Adwokat","2","kg.","","","d - Ciasta kremowo-śmietanowe"]},{"id": "2473_3", "cell":["","1","1","1","70","116","1","2473","Adwokat","","kg.","","","d - Ciasta kremowo-śmietanowe"]}]} 

. 내가 틀렸어? 내 코드에 버그가있는 경우 도와주세요.

+0

jsonReader 구성을 사용해 보았습니까? jsonReader : –

+0

예 나는이 코드를 시도 { \t 루트 : "행", \t 페이지 : "페이지", \t 총 : "총", \t 기록 : "기록", \t repeatitems : 사실, \t cell : "cell", \t id : "id" \t}, 성공하지 못함 - filterToolbar 필드에 문자를 입력해도 데이터가 사라집니다. – sztubi

답변

0

올레그에서이 대답을 확인하십시오. jqGrid client-side searching

뭔가를 검색하는 경우 구현해야하므로 구현 코드는 어디에 있습니까? 위의 링크를 확인하고, 거기에 검색 기준을 저장하고 있습니다.

+0

이 답변은 단일 필드 검색 용이지만 filterToolbar를 사용합니다. 어쨌든 응답 주셔서 감사합니다. 물론 사용합니다 : orderPosGrid.filterToolbar ({searchOnEnter : false, stringResult : true}); – sztubi

+0

누구나 filterToolbar와 비슷한 문제가 있습니까? 필터 필드에 뭔가 넣으면 모든 행이 사라집니다. 어떤 조언을 주셔서 감사합니다. – sztubi

관련 문제