jqgrid寻呼机按钮(下一个,上一个,第一个,最后一个)不可见

时间:2014-12-04 21:09:29

标签: jquery jqgrid

以下是分页工作的问题,但寻呼机的图标(下一个,上一个,第一个,最后一个) 在UI中不可见。但是当我点击它们中的任何一个时(图标通常位于第1页,共3页的任何一侧,这是可见的。不确定是什么导致了这个问题。

这是jquery代码:

       grid.jqGrid({
            datatype: "local",
            data:this.get('mydata').data,
            colNames:['ID', 'First Name','Last Name'],
            colModel:[
                {name:'id',index:'id', key: true, width:70, sorttype:"int"},
                {name:'firstName',index:'firstName', width:90},
                {name:'lastName',index:'lastName', width:100}

            ],
            search:true,
            pager:'#pager',
            localReader: {cell:""},
            rowNum: 10,
            rowList: [5, 10, 20, 50],
            //loadatonce:false,
            sortname: 'id',
            sortorder: 'asc',
            viewrecords: true,
            sortable:false,
            cmTemplate: {sortable:true},//change to false if want
            multiselect:true,
            multiboxonly: false,
            height: "100%",
            caption: "Multiple search with local data",
            onSelectAll:function(aRowids,isSelected){
            // this is not used in this sample.. as I removed the check all button
              var i, count, id;
              for (i = 0, count = aRowids.length; i < count; i++) {
                   id = aRowids[i];
                   if(isSelected)
                     {mysel.pushObject(id);}
                     else
                    { mysel.removeObject(id);}

              }

              that.set('selection',mysel);
            },
            gridComplete: function(){

                          },
           loadComplete: function(){
               grid.jqGrid('setGridParam', {
                   page: page,
                   records: records,
                   lastpage: lastpage
               });
               this.updatepager(false, true);
             },
            onPaging: function(pgButton){

              var pageNumber = $(this).jqGrid("getGridParam", "page");
                 //alert("page number is "+pageNumber);
                // alert("pgButton ===== "+pgButton);
                 if(pgButton === 'next_pager') {
                    pageNumber  =  pageNumber+1;
                   page  =  pageNumber;
                 }else if(pgButton === 'prev_pager') {
                    pageNumber  =  pageNumber-1;
                    page  =  pageNumber;
                  }else if(pgButton === 'last_pager') {
                    pageNumber  =  lastpage;
                    page  =  pageNumber;
                  }else if(pgButton === 'first_pager') {
                     pageNumber  =  1;
                     page  =  pageNumber;
                  }
                 var pageSize  = $(this).jqGrid("getGridParam", "rowNum");
                //alert("rowNum   ====="+pageSize);
                 // grid.jqGrid('setGridParam', {data: dataToLoad});
                 that.store.find("oldcontact",{page:pageNumber,pagesize:pageSize}).then(function(dataToLoad){
                         var data=[];
                           grid.jqGrid('clearGridData');
                           //var gridBody = grid.children("tbody");
                          // gridBody.empty();
                            dataToLoad.forEach(function(item){
                                    var hash={};
                                    var count =0;
                                    var type = that.store.modelFor('oldcontact');
                                    var fields = Ember.get(type, 'fields');
                                    hash['id']=item.get('id');
                                    fields.forEach(function(field) {
                                        hash[field]=item.get(field);
                                     });
                                  // grid.jqGrid('addRowData',count,hash);
                                   count = count+1;
                                   data.push(hash);
                         });
                              var meta =  that.store.metadataFor("oldcontact");
                              page = meta.page;
                              lastpage = meta.lastpage;
                              records = meta.records;
                               grid.jqGrid('setGridParam', {data: data});
                               grid.trigger('reloadGrid');

                 });
            },



        });

1 个答案:

答案 0 :(得分:0)

这就是我这样做的方式

$("#next_jqGridPager").find(".ui-icon-seek-next")
.css({ "background-image": "url('/Content/arrowright.png')", "background-position": "0", "height": "20" });

$("#prev_jqGridPager").find(".ui-icon-seek-prev")
.css({ "background-image": "url('/Content/arrowleft.png')", "background-position": "0", "height": "20" });
$(".ui-pg-input").css({ "height": "20" })