2013-03-06 2 views
0

Я пытаюсь реализовать панель инструментов фильтра в моем jqgrid. Но всякий раз, когда я ввожу что-либо в любое окно поиска панели инструментов фильтра, появляется всплывающее окно «Загрузка» и остается там, и тогда ничего не происходит. Ниже приведен снимок:Панель инструментов фильтра jqgrid не работает

The Error

Ниже мой jqgrid код:

jQuery(document).ready(function($) { 

    $('#workQueueGrid').jqGrid('GridDestroy'); 
    $("#workQueueGrid").jqGrid({ 
     url:contextRoot+'workQueueGrid', 
     datatype: 'json', 
     mtype: 'POST', 
     colNames: ['ID','Received','Last Name','First Name','Aa','Bbbb', 'Source', 'Ddddd', 'Ccccc', 'Eeeeee', 'Fffffff', 'Ggggggg', 'Hhhhhhh'], 
     colModel: [ 
        { name: 'Id', index: 'referralId', width: 30, sortable:true }, 
        { name: 'receivedDate', index: 'receivedDate', width: 50, formatter: function(cellValue){return $.datepicker.formatDate('mm-dd-yy', new Date(cellValue));}, sortable:true },     
        { name: 'lastName', index: 'lastName', width: 55, sortable:true }, 
        { name: 'firstName', index: 'firstName', width: 55, sortable:true }, 
        { name: 'data1', index: 'data1', width: 30, sortable:true }, 
        { name: 'data2', index: 'data2', width: 30, sortable:true }, 
        { name: 'data3', index: 'data3', width: 40, sortable:true, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"'; } }, 
        { name: 'data4', index: 'data4', width: 30, sortable:true, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"'; } }, 
        { name: 'data5', index: 'data5', width: 40, sortable:true, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"'; } }, 
        { name: 'data6', index: 'data6', width: 50, formatter: function(cellValue){return $.datepicker.formatDate('mm-dd-yy', new Date(cellValue));}, sortable:true }, 
        { name: 'data7', index: 'data7', width: 50, formatter: function(cellValue){return $.datepicker.formatDate('mm-dd-yy', new Date(cellValue));}, sortable:true }, 
        { name: 'data8', index: 'data8', width: 50, formatter: function(cellValue){return $.datepicker.formatDate('mm-dd-yy', new Date(cellValue));}, sortable:true }, 
        { name: 'data9', index: 'data9', width: 80, sortable:true, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"'; } } 
     ],loadError: function(xhr,st,err) { 
      alert(err); 
     },onSelectRow : function(rowid, status, e) { 
      var selRow = $(this).getGridParam("selrow"); 
      var selReferralId = $(this).getCell(selRow, 'referralId'); 
      window.location = (contextRoot+"referralDetails?refId=" + selReferralId);    
     }, 
     jsonReader: { 
      repeatitems: false, 
     }, 
     pager: '#workQueuePager', 
     sortname: 'receivedDate', 
     sortorder: 'desc', 
     gridview: true, 
     viewrecords: true, 
     loadonce: true, 
     autowidth: true, 
     shrinkToFit: true, 
     height: 'auto', 
     rowNum: 12, 
     ignoreCase: true, 
     altRows:true 
    }); 

    $("#workQueueGrid").jqGrid('navGrid','#workQueuePager', 
     { 
     edit:false, 
     add:false, 
     del:false, 
     search:false, 
     refresh:false 
    }); 

    $("#workQueueGrid").jqGrid('filterToolbar', 
     { 
     stringResult: true, 
     searchOnEnter: false, 
     defaultSearch: "bw" 
    }); 
}); 

Образец данных:

{"rows":[{"receivedDate":1357016400000,"referralId":23450,"lastName":"Smith","firstName":"John","goCode":"A99","zoneCode":"NE","sourceName":"Source Name","status":"Pending","actionAS":"AS Action","vpReportDate":1357016400000,"approvedDate":1357016400000,"lastModifiedDate":1357016400000,"workflow":"Recommendation(s) required"},{"receivedDate":1357102800000,"referralId":23451,"lastName":"Smith","firstName":"John","goCode":"A99","zoneCode":"NE","sourceName":"Source Name","status":"Pending","actionAS":"AS Action","vpReportDate":1357102800000,"approvedDate":1357102800000,"lastModifiedDate":1357102800000,"workflow":"Recommendation(s) required"},{"receivedDate":1357189200000,"referralId":23452,"lastName":"Smith","firstName":"John","goCode":"A99","zoneCode":"NE","sourceName":"Source Name","status":"Pending","actionAS":"AS Action","vpReportDate":1357189200000,"approvedDate":1357189200000,"lastModifiedDate":1357189200000,"workflow":"Recommendation(s) required"}, 

Не уверен, что я здесь отсутствует?!?

Обновление 1:

Below is the error I'm getting: 

Uncaught TypeError: Cannot call method 'getAccessor' of undefined 

Обновление 2

Ниже СПЯ:

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<html> 
<head> 
    <script type="text/javascript" src="<c:url value="/js/workQueue.js"/>"></script> 
    <style type="text/css"> 
     th.ui-th-column div { 
      white-space:normal !important; 
      height:auto !important; 
      padding:2px; 
    } 
    </style>  
</head> 
<body> 
    <table width="100%"> 
     <tr> 
      <td> 
       <span style="font-size: 18px"><b>${status == 'pending' ? 'Pending': 'Approved'}</b></span><br/><br/> 
       There are ${workQueueCount} referrals ${status}. Click a row to see details.<a href="<c:url value="/excelExport"/>" id="excelExport" style="float: right;">Export To Excel</a>    
      </td> 
     </tr> 
     <tr height="5px"> 
      <td>        
      </td> 
     </tr> 
     <tr> 
      <td> 
       <table id="dartWorkQueueGrid"></table>        
       <div id="dartWorkQueuePager"></div> 
      </td> 
     </tr> 
    </table> 
</body> 
</html> 

Это метод Обработчик:

 @RequestMapping(method = RequestMethod.POST, value = "/workQueueGrid") 
    @ResponseBody 
    public JqgridResponse loadWorkQueue() { 
     this.referrals = dartService.getReferralCases(status);  
     JqgridResponse response = new JqgridResponse(); 
     response.setRows(referrals); 

     return response; 
    } 

Это JqgridResponse.java:

package com.nyl.corp.disciplinaryactions.web; 

import java.util.List; 

public class JqgridResponse { 

    public JqgridResponse(List<?> rows) { 
     this.rows = rows; 
    } 

    public JqgridResponse() { 
    } 

    private List<?> rows; 

    private int page; 

    private int total; 

    private int records; 

    public void setRows(List<?> rows) { 
     this.rows = rows; 
    } 

    public List<?> getRows() { 
     return rows; 
    } 

    public int getPage() { 
     return page; 
    } 

    public void setPage(int page) { 
     this.page = page; 
    } 

    public int getTotal() { 
     return total; 
    } 

    public void setTotal(int total) { 
     this.total = total; 
    } 

    public int getRecords() { 
     return records; 
    } 

    public void setRecords(int records) { 
     this.records = records; 
    } 

} 

UPDATE 3 Снимок из сетки внутри вкладки:

enter image description here enter image description here

Update 4 Вкладки JSP код:

<script>  
    $(function() { 
     $("#workQueuesTab").tabs(); 
    });  
</script> 
</head> 
<body> 
     <div style="width:95%" id="workQueuesTab"> 
      <ul> 
       <li><a href="<c:url value="/workQueue/pending"/>">Pending</a></li> 
       <li><a href="<c:url value="/workQueue/approved"/>">Approved</a></li> 
       <li><a href="<c:url value="/workQueue/additionalSteps"/>">Additional Steps</a></li> 
     </ul> 
     </div>    
</body> 
+0

Из моего прошлого опыта, проблема вы описываете происходит, когда происходит ошибка сервера. Получаете ли вы действительный ответ со своего сервера? – Kyle

+0

@Kyle Я реализую фильтрацию на стороне клиента. Данные загружаются с сервера отлично, поэтому они отображаются в сетке. Также я не получаю никакой ошибки сервера. – tarares

+0

@Kyle Я обновил вопрос с образцами данных JSON, которые возвращаются с сервера. – tarares

ответ

0

У меня была та же проблема. В файле jquery.jqGrid.js,

он вызывает jQuery jQuery. Похоже, ваши настройки не распознают этот способ. попробуйте изменить jQuery. до $. всюду в файле.

Это действительно работало для меня.

Uncaught TypeError: Невозможно вызвать метод «getAccessor» неопределенных (он не понимает JQuery, но это не $.).

Смежные вопросы