java
  • jquery
  • jsp
  • jqgrid
  • struts
  • 2012-03-01 49 views 2 likes 
    2

    我想單擊下一個按鈕,但它不起作用,它只發生在我點擊搜索按鈕時,他的結果從第一頁出現,但然後聞一點擊翻頁按鈕,它不工作,任何人都可以請幫助:該代碼如下:問題與jqGrid和jQuery的下一個和前一個點擊事件

    <script type="text/javascript"> 
          var initGridUri = '<%=request.getContextPath()%>/searchNodeAlerts.action?rand=<%=rand%>'; 
          var qs = window.location.search.substring(1); 
          var qsArray = qs.split('&'); 
          var qsSearch; 
          var qsKeyword; 
          var qsSource; 
          var s; 
          for (i=0;i<qsArray.length;i++) { 
           var cs = qsArray[i].split('='); 
           if (cs[0] == 'as'){ 
            qsSearch = cs[1]; 
           } else if (cs[0] == 'k'){ 
            qsKeyword = cs[1]; 
           } else if (cs[0] == 'sn'){ 
            qsSource = cs[1]; 
           } 
          } 
    
         myStack = new Array(); 
         $(document).ready(function(){ 
          if (qsSearch == 'true'){ 
           initGridUri = '<%=request.getContextPath()%>/searchNodeAlerts.action?rand=<%=rand%>&keyword='+ qsKeyword +'&sourceNumber='+ qsSource; 
          } 
    
          $("#workspace").tabs(); 
          $("#bin-search-submit").live('click',function(){nodeSearchSubmit()}) 
          $("#bin-search-reset").click(function(){binSearchReset()}); 
    
          $("#bin-search-publish-start, #bin-search-publish-end").datepicker(); 
          $("#bin-advanced-search").toggle(
           function(){ 
            $("#bin-search").animate({height:435}, 500); 
            $(this).removeClass('ui-icon ui-icon-arrowstop-1-s'); 
            $(this).addClass('ui-icon ui-icon-arrowstop-1-n'); 
           }, 
           function(){ 
            $("#bin-search").animate({height:110}, 500); 
            $(this).removeClass('ui-icon ui-icon-arrowstop-1-n'); 
            $(this).addClass('ui-icon ui-icon-arrowstop-1-s'); 
           } 
          ) 
    
          $("#bin-search-source").change(function(){binSearchSource(this)}) 
    
          $("#refGrid").jqGrid({ 
           jsonReader : { 
            root: "serachResultList", 
            page: "page", 
            total: "total", 
            records: "records", 
            repeatitems: false 
           }, 
           datatype: function(postdata) { 
            jqGridDataRequest(initGridUri, postdata, "refGrid",'onGridLoadComplete()') 
           }, 
           <sh:hztClientPref reverse="false" prefname="RELATED_ALERTS" value="Enabled"> 
            colNames:['Actions','Recall #','Title', 'Source', 'Source No','Date','Status','RefID', 'Related'], 
           </sh:hztClientPref> 
           <sh:hztClientPref reverse="false" prefname="RELATED_ALERTS" value="Disabled"> 
            colNames:['Actions','Recall #','Title', 'Source', 'Source No','Date','Status','RefID'], 
           </sh:hztClientPref> 
           colModel:[      
            {name:'act',index:'act', width:85, sortable:false}, 
            {name:'hztNumber',index:'hztNumber', width:80, sortable:true}, 
            {name:'title',index:'title', width:205, formatter:newLine}, 
            {name:'source',index:'source', width:50, sortable:true}, 
            {name:'sourceAlertNumber',index:'sourceAlertNumber', width:55, sortable:false}, 
            {name:'receivedDate', index:'receivedDate', width:70, formatter:newDate, sortable:true}, 
            {name:'status',index:'status', width:50, sortable:false}, 
            {name:'refId',index:'refId', hidden:true}, 
            <sh:hztClientPref reverse="false" prefname="RELATED_ALERTS" value="Enabled"> 
             {name:'relatedAlertPresent',index:'relatedAlertPresent', hidden:true} 
            </sh:hztClientPref> 
           ], 
           rowNum:20, 
           height:'auto', 
           viewrecords: true, 
           pgbuttons: true, 
           sortname: 'receivedDate', 
           sortorder: 'desc', 
           pager: '#refPager', 
           multiselect: true 
    
          }) 
         }); 
    
         function nodeSearchSubmit(){ 
    
          var keyword = $('input[name=keyword]'); 
          var title = $('input[name=title]'); 
          var sourceNumber = $('input[name=sourceNumber]'); 
          var startReceiveDate = $('input[name=startReceiveDate]'); 
          var endReceivedate = $('input[name=endReceiveDate]'); 
          var source = $('select[name=source]'); 
          var status = $('select[name=status]'); 
          var recallNo = $('input[name=recallNo]'); 
          var page = $('page'); 
    
          var data = 'keyword='+ keyword.val() +'&title='+ title.val() +'&sourceAlertNumber='+ sourceNumber.val() +'&startReceiveDate='+ startReceiveDate.val() 
             +'&endReceiveDate='+ endReceivedate.val() +'&source='+ source.val() + '&status='+status.val() + '&hztNumber='+recallNo.val(); 
    
          var request = '<%=request.getContextPath()%>/searchNodeAlerts.action?rand=<%=rand%>&page=1&'+ data; 
    <%=rand%>' + data; 
    
          initGridUri = request;   
          jQuery("#refGrid").trigger("reloadGrid") 
    
         } 
    

    回答

    1

    這裏有不是足夠的信息來回答有把握這個問題。點擊下一個按鈕後,您應該包含來自服務器的響應。

    如果我不得不猜測,我會說響應包含JavaScript,可能會導致頁面出現js錯誤,或者覆蓋某些導致下一個按鈕中斷的變量。

    請問包含javascript?

    相關問題