jqGrid和jquery下一个和上一个点击事件的问题

时间:2012-03-01 19:17:48

标签: java jquery jsp jqgrid struts

我试图点击下一个按钮但它不起作用,只有当我点击搜索按钮并且他的结果出现在第一页时才会发生,但是后来我点击下一页按钮它没有工作可以请任何人帮忙:代码如下:

    <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 个答案:

答案 0 :(得分:1)

这里没有足够的信息可以肯定地回答这个问题。单击下一步按钮后,应包括服务器的响应。

如果我不得不猜测我会说响应包含javascript导致页面上出现js错误,或者覆盖某个变量导致下一个按钮中断。

响应是否包含javascript?